// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package ante
import (
"fmt"
"runtime/debug"
ethante "github.com/evmos/ethermint/app/ante"
cctxtypes "github.com/zeta-chain/zetacore/x/crosschain/types"
tmlog "github.com/tendermint/tendermint/libs/log"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
)
func ValidateHandlerOptions(options ethante.HandlerOptions) error {
if options.AccountKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "sign mode handler is required for ante builder")
}
if options.FeeMarketKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "fee market keeper is required for AnteHandler")
}
if options.EvmKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "evm keeper is required for AnteHandler")
}
return nil
}
// NewAnteHandler returns an ante handler responsible for attempting to route an
// Ethereum or SDK transaction to an internal ante handler for performing
// transaction-level processing (e.g. fee payment, signature verification) before
// being passed onto it's respective handler.
func NewAnteHandler(options ethante.HandlerOptions) (sdk.AnteHandler, error) {
if err := ValidateHandlerOptions(options); err != nil {
return nil, err
}
return func(
ctx sdk.Context, tx sdk.Tx, sim bool,
) (newCtx sdk.Context, err error) {
var anteHandler sdk.AnteHandler
defer Recover(ctx.Logger(), &err)
txWithExtensions, ok := tx.(authante.HasExtensionOptionsTx)
if ok {
opts := txWithExtensions.GetExtensionOptions()
if len(opts) > 0 {
switch typeURL := opts[0].GetTypeUrl(); typeURL {
case "/ethermint.evm.v1.ExtensionOptionsEthereumTx":
// handle as *evmtypes.MsgEthereumTx
anteHandler = newEthAnteHandler(options)
case "/ethermint.types.v1.ExtensionOptionsWeb3Tx":
// Deprecated: Handle as normal Cosmos SDK tx, except signature is checked for Legacy EIP712 representation
anteHandler = NewLegacyCosmosAnteHandlerEip712(options)
case "/ethermint.types.v1.ExtensionOptionDynamicFeeTx":
// cosmos-sdk tx with dynamic fee extension
anteHandler = newCosmosAnteHandler(options)
default:
return ctx, errorsmod.Wrapf(
errortypes.ErrUnknownExtensionOptions,
"rejecting tx with unsupported extension option: %s", typeURL,
)
}
return anteHandler(ctx, tx, sim)
}
}
// handle as totally normal Cosmos SDK tx
switch tx.(type) {
case sdk.Tx:
found := false
for _, msg := range tx.GetMsgs() {
switch msg.(type) {
// treat these two msg types differently because they might call EVM which results in massive gas consumption
// For these two msg types, we don't check gas limit by using a different ante handler
case *cctxtypes.MsgGasPriceVoter, *cctxtypes.MsgVoteOnObservedInboundTx:
found = true
break
}
}
if found {
// this differs newCosmosAnteHandler only in that it doesn't check gas limit
// by using an Infinite Gas Meter.
anteHandler = newCosmosAnteHandlerNoGasLimit(options)
} else {
anteHandler = newCosmosAnteHandler(options)
}
default:
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid transaction type: %T", tx)
}
return anteHandler(ctx, tx, sim)
}, nil
}
func Recover(logger tmlog.Logger, err *error) {
if r := recover(); r != nil {
if err != nil {
// #nosec G703 err is checked non-nil above
*err = errorsmod.Wrapf(errortypes.ErrPanic, "%v", r)
}
if e, ok := r.(error); ok {
logger.Error(
"ante handler panicked",
"error", e,
"stack trace", string(debug.Stack()),
)
} else {
logger.Error(
"ante handler panicked",
"recover", fmt.Sprintf("%v", r),
)
}
}
}
package ante
import (
"fmt"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/authz"
"github.com/cosmos/cosmos-sdk/x/group"
)
// maxNestedMsgs defines a cap for the number of nested messages on a MsgExec message
const maxNestedMsgs = 15
// AuthzLimiterDecorator blocks certain msg types from being granted or executed
// within the authorization module.
type AuthzLimiterDecorator struct {
// disabledMsgTypes is the type urls of the msgs to block.
disabledMsgTypes []string
}
// NewAuthzLimiterDecorator creates a decorator to block certain msg types from being granted or executed within authz.
func NewAuthzLimiterDecorator(disabledMsgTypes ...string) AuthzLimiterDecorator {
return AuthzLimiterDecorator{
disabledMsgTypes: disabledMsgTypes,
}
}
func (ald AuthzLimiterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
if err := ald.checkDisabledMsgs(tx.GetMsgs(), false, 1); err != nil {
return ctx, errorsmod.Wrapf(errortypes.ErrUnauthorized, err.Error())
}
return next(ctx, tx, simulate)
}
// checkDisabledMsgs iterates through the msgs and returns an error if it finds any unauthorized msgs.
//
// When searchOnlyInAuthzMsgs is enabled, only authz MsgGrant and MsgExec are blocked, if they contain unauthorized msg types.
// Otherwise any msg matching the disabled types are blocked, regardless of being in an authz msg or not.
//
// This method is recursive as MsgExec's can wrap other MsgExecs. The check for nested messages is performed up to the
// maxNestedMsgs threshold. If there are more than that limit, it returns an error
func (ald AuthzLimiterDecorator) checkDisabledMsgs(msgs []sdk.Msg, isAuthzInnerMsg bool, nestedLvl int) error {
if nestedLvl >= maxNestedMsgs {
return fmt.Errorf("found more nested msgs than permited. Limit is : %d", maxNestedMsgs)
}
for _, msg := range msgs {
switch msg := msg.(type) {
case *authz.MsgExec:
innerMsgs, err := msg.GetMessages()
if err != nil {
return err
}
nestedLvl++
if err := ald.checkDisabledMsgs(innerMsgs, true, nestedLvl); err != nil {
return err
}
case *group.MsgSubmitProposal:
innerMsgs, err := msg.GetMsgs()
if err != nil {
return err
}
nestedLvl++
if err := ald.checkDisabledMsgs(innerMsgs, true, nestedLvl); err != nil {
return err
}
case *authz.MsgGrant:
authorization, err := msg.GetAuthorization()
if err != nil {
return err
}
url := authorization.MsgTypeURL()
if ald.isDisabledMsg(url) {
return fmt.Errorf("found disabled msg type: %s", url)
}
default:
url := sdk.MsgTypeURL(msg)
if isAuthzInnerMsg && ald.isDisabledMsg(url) {
return fmt.Errorf("found disabled msg type: %s", url)
}
}
}
return nil
}
// isDisabledMsg returns true if the given message is in the list of restricted
// messages from the AnteHandler.
func (ald AuthzLimiterDecorator) isDisabledMsg(msgTypeURL string) bool {
for _, disabledType := range ald.disabledMsgTypes {
if msgTypeURL == disabledType {
return true
}
}
return false
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package ante
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ethante "github.com/evmos/ethermint/app/ante"
ethermint "github.com/evmos/ethermint/types"
)
func NewLegacyCosmosAnteHandlerEip712(options ethante.HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
ethante.RejectMessagesDecorator{}, // reject MsgEthereumTxs
NewAuthzLimiterDecorator(options.DisabledAuthzMsgs...),
NewVestingAccountDecorator(),
ante.NewSetUpContextDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ethante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
// Note: signature verification uses EIP instead of the cosmos signature validator
ethante.NewLegacyEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
)
}
func newEthAnteHandler(options ethante.HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
ethante.NewEthSetUpContextDecorator(options.EvmKeeper), // outermost AnteDecorator. SetUpContext must be called first
ethante.NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices
ethante.NewEthMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper), // Check eth effective gas price against the global MinGasPrice
ethante.NewEthValidateBasicDecorator(options.EvmKeeper),
ethante.NewEthSigVerificationDecorator(options.EvmKeeper),
ethante.NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
ethante.NewCanTransferDecorator(options.EvmKeeper),
ethante.NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted),
ethante.NewEthIncrementSenderSequenceDecorator(options.AccountKeeper), // innermost AnteDecorator.
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
ethante.NewEthEmitEventDecorator(options.EvmKeeper), // emit eth tx hash and index at the very last ante handler.
)
}
func newCosmosAnteHandler(options ethante.HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
ethante.RejectMessagesDecorator{}, // reject MsgEthereumTxs
NewAuthzLimiterDecorator(options.DisabledAuthzMsgs...),
NewVestingAccountDecorator(),
ante.NewSetUpContextDecorator(),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ethante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
)
}
// this applies to special cosmos tx that calls EVM, in which case the EVM overrides the gas limit
func newCosmosAnteHandlerNoGasLimit(options ethante.HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
ethante.RejectMessagesDecorator{}, // reject MsgEthereumTxs
NewAuthzLimiterDecorator(options.DisabledAuthzMsgs...),
NewVestingAccountDecorator(),
NewSetUpContextDecorator(),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ethante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
)
}
var _ GasTx = (*legacytx.StdTx)(nil) // assert StdTx implements GasTx
// GasTx defines a Tx with a GetGas() method which is needed to use SetUpContextDecorator
type GasTx interface {
sdk.Tx
GetGas() uint64
}
// SetUpContextDecorator sets the GasMeter in the Context and wraps the next AnteHandler with a defer clause
// to recover from any downstream OutOfGas panics in the AnteHandler chain to return an error with information
// on gas provided and gas used.
// CONTRACT: Must be first decorator in the chain
// CONTRACT: Tx must implement GasTx interface
type SetUpContextDecorator struct{}
func NewSetUpContextDecorator() SetUpContextDecorator {
return SetUpContextDecorator{}
}
func (sud SetUpContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
// all transactions must implement GasTx
gasTx, ok := tx.(GasTx)
if !ok {
// Set a gas meter with limit 0 as to prevent an infinite gas meter attack
// during runTx.
newCtx = SetGasMeter(simulate, ctx, 0)
return newCtx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be GasTx")
}
newCtx = SetGasMeter(simulate, ctx, gasTx.GetGas())
// Decorator will catch an OutOfGasPanic caused in the next antehandler
// AnteHandlers must have their own defer/recover in order for the BaseApp
// to know how much gas was used! This is because the GasMeter is created in
// the AnteHandler, but if it panics the context won't be set properly in
// runTx's recover call.
defer func() {
if r := recover(); r != nil {
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
log := fmt.Sprintf(
"out of gas in location: %v; gasWanted: %d, gasUsed: %d",
rType.Descriptor, gasTx.GetGas(), newCtx.GasMeter().GasConsumed())
err = sdkerrors.Wrap(sdkerrors.ErrOutOfGas, log)
default:
panic(r)
}
}
}()
return next(newCtx, tx, simulate)
}
// SetGasMeter returns a new context with a gas meter set from a given context.
func SetGasMeter(_ bool, ctx sdk.Context, gasLimit uint64) sdk.Context {
// In various cases such as simulation and during the genesis block, we do not
// meter any gas utilization.
//if simulate || ctx.BlockHeight() == 0 {
// return ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
//}
//
//return ctx.WithGasMeter(sdk.NewGasMeter(gasLimit))
return ctx.WithGasMeter(ethermint.NewInfiniteGasMeterWithLimit(gasLimit))
}
package ante
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
)
var _ sdk.AnteDecorator = VestingAccountDecorator{}
// VestingAccountDecorator blocks vesting messages from reaching the mempool
type VestingAccountDecorator struct {
disabledMsgTypeURLs []string
}
// NewVestingAccountDecorator creates a decorator to block vesting messages from reaching the mempool
func NewVestingAccountDecorator() VestingAccountDecorator {
return VestingAccountDecorator{
disabledMsgTypeURLs: []string{
sdk.MsgTypeURL(&vesting.MsgCreateVestingAccount{}),
sdk.MsgTypeURL(&vesting.MsgCreatePermanentLockedAccount{}),
sdk.MsgTypeURL(&vesting.MsgCreatePeriodicVestingAccount{}),
},
}
}
// AnteHandle implements AnteDecorator
func (vad VestingAccountDecorator) AnteHandle(
ctx sdk.Context,
tx sdk.Tx,
simulate bool,
next sdk.AnteHandler,
) (newCtx sdk.Context, err error) {
for _, msg := range tx.GetMsgs() {
typeURL := sdk.MsgTypeURL(msg)
for _, disabledTypeURL := range vad.disabledMsgTypeURLs {
if typeURL == disabledTypeURL {
return ctx, errorsmod.Wrapf(
sdkerrors.ErrUnauthorized,
"MsgTypeURL %s not supported",
typeURL,
)
}
}
}
return next(ctx, tx, simulate)
}
package main
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)
func AddrConversionCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "addr-conversion [zeta address]",
Short: "convert a zeta1xxx address to validator operator address zetavaloper1xxx",
Long: `
read a zeta1xxx or zetavaloper1xxx address and convert it to the other type;
it always outputs three lines; the first line is the zeta1xxx address, the second line is the zetavaloper1xxx address
and the third line is the ethereum address.
`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
addr, err := sdk.AccAddressFromBech32(args[0])
if err == nil {
valAddr := sdk.ValAddress(addr.Bytes())
fmt.Printf("%s\n", addr.String())
fmt.Printf("%s\n", valAddr.String())
fmt.Printf("%s\n", ethcommon.BytesToAddress(addr.Bytes()).String())
return nil
}
valAddr, err := sdk.ValAddressFromBech32(args[0])
if err == nil {
addr := sdk.AccAddress(valAddr.Bytes())
fmt.Printf("%s\n", addr.String())
fmt.Printf("%s\n", valAddr.String())
fmt.Printf("%s\n", ethcommon.BytesToAddress(addr.Bytes()).String())
return nil
}
ethAddr := ethcommon.HexToAddress(args[0])
if ethAddr != (ethcommon.Address{}) {
addr := sdk.AccAddress(ethAddr.Bytes())
valAddr := sdk.ValAddress(addr.Bytes())
fmt.Printf("%s\n", addr.String())
fmt.Printf("%s\n", valAddr.String())
fmt.Printf("%s\n", ethAddr.String())
return nil
}
return fmt.Errorf("invalid address: %s", args[0])
},
}
return cmd
}
package main
import (
"encoding/json"
"os"
"path/filepath"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/app"
)
func CollectObserverInfoCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "collect-observer-info [folder]",
Short: "collect observer info from a folder , default path is ~/.zetacored/os_info/ \n",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
defaultHome := app.DefaultNodeHome
defaultFile := filepath.Join(defaultHome, "os_info")
if len(args) == 0 {
args = append(args, defaultFile)
}
directory := args[0]
files, err := os.ReadDir(directory)
if err != nil {
return err
}
var observerInfoList []ObserverInfoReader
err = os.Chdir(directory)
if err != nil {
return err
}
for _, file := range files {
var observerInfo ObserverInfoReader
info, err := file.Info()
if err != nil {
return err
}
f, err := os.ReadFile(info.Name())
if err != nil {
return err
}
err = json.Unmarshal(f, &observerInfo)
if err != nil {
return err
}
observerInfoList = append(observerInfoList, observerInfo)
}
file, err := json.MarshalIndent(observerInfoList, "", " ")
if err != nil {
return err
}
err = os.WriteFile("observer_info.json", file, 0600)
if err != nil {
return err
}
return nil
},
}
return cmd
}
package main
import (
"fmt"
"github.com/spf13/cobra"
)
var KeyAddCommand = []string{"keys", "add"}
const (
HDPathFlag = "hd-path"
HDPathEthereum = "m/44'/60'/0'/0/0"
)
// SetEthereumHDPath sets the default HD path to Ethereum's
func SetEthereumHDPath(cmd *cobra.Command) error {
return ReplaceFlag(cmd, KeyAddCommand, HDPathFlag, HDPathEthereum)
}
// ReplaceFlag replaces the default value of a flag of a sub-command
func ReplaceFlag(cmd *cobra.Command, subCommand []string, flagName, newDefaultValue string) error {
// Find the sub-command
c, _, err := cmd.Find(subCommand)
if err != nil {
return fmt.Errorf("failed to find %v sub-command: %v", subCommand, err)
}
// Get the flag from the sub-command
f := c.Flags().Lookup(flagName)
if f == nil {
return fmt.Errorf("%s flag not found in %v sub-command", flagName, subCommand)
}
// Set the default value for the flag
f.DefValue = newDefaultValue
if err := f.Value.Set(newDefaultValue); err != nil {
return fmt.Errorf("failed to set the value of %s flag: %v", flagName, err)
}
return nil
}
package main
import (
"encoding/json"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/common"
ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
)
const (
flagVestingStart = "vesting-start-time"
flagVestingEnd = "vesting-end-time"
flagVestingAmt = "vesting-amount"
)
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command {
cmd := &cobra.Command{
Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]",
Short: "Add a genesis account to genesis.json",
Long: `Add a genesis account to genesis.json. The provided account must specify
the account address or key name and a list of initial coins. If a key name is given,
the address will be looked up in the local Keybase. The list of initial tokens must
contain valid denominations. Accounts may optionally be supplied with vesting parameters.
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
kr := clientCtx.Keyring
config.SetRoot(clientCtx.HomeDir)
addr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
info, err := kr.Key(args[0])
if err != nil {
return fmt.Errorf("failed to get address from Keyring: %w", err)
}
addr, err = info.GetAddress()
if err != nil {
return err
}
}
coins, err := sdk.ParseCoinsNormalized(args[1])
if err != nil {
return fmt.Errorf("failed to parse coins: %w", err)
}
vestingStart, err := cmd.Flags().GetInt64(flagVestingStart)
if err != nil {
return fmt.Errorf("failed to parse vesting start: %w", err)
}
vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd)
if err != nil {
return fmt.Errorf("failed to parse vesting end: %w", err)
}
vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt)
if err != nil {
return fmt.Errorf("failed to parse vesting amount: %w", err)
}
vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr)
if err != nil {
return fmt.Errorf("failed to parse vesting amount: %w", err)
}
// create concrete account type based on input parameters
var genAccount authtypes.GenesisAccount
balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}
baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0)
if !vestingAmt.IsZero() {
baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) ||
baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) {
return errors.New("vesting amount cannot be greater than total amount")
}
switch {
case vestingStart != 0 && vestingEnd != 0:
genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart)
case vestingEnd != 0:
genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount)
default:
return errors.New("invalid vesting parameters; must supply start and end time or end time")
}
} else {
genAccount = ðermint.EthAccount{
BaseAccount: baseAccount,
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
}
}
if err := genAccount.Validate(); err != nil {
return fmt.Errorf("failed to validate new genesis account: %w", err)
}
genFile := config.GenesisFile()
appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile)
if err != nil {
return fmt.Errorf("failed to unmarshal genesis state: %w", err)
}
authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState)
accs, err := authtypes.UnpackAccounts(authGenState.Accounts)
if err != nil {
return fmt.Errorf("failed to get accounts from any: %w", err)
}
if accs.Contains(addr) {
return fmt.Errorf("cannot add account at existing address %s", addr)
}
// Add the new account to the set of genesis accounts and sanitize the
// accounts afterwards.
accs = append(accs, genAccount)
accs = authtypes.SanitizeGenesisAccounts(accs)
genAccs, err := authtypes.PackAccounts(accs)
if err != nil {
return fmt.Errorf("failed to convert accounts into any's: %w", err)
}
authGenState.Accounts = genAccs
authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState)
if err != nil {
return fmt.Errorf("failed to marshal auth genesis state: %w", err)
}
appState[authtypes.ModuleName] = authGenStateBz
bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState)
bankGenState.Balances = append(bankGenState.Balances, balances)
bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances)
bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...)
bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState)
if err != nil {
return fmt.Errorf("failed to marshal bank genesis state: %w", err)
}
appState[banktypes.ModuleName] = bankGenStateBz
appStateJSON, err := json.Marshal(appState)
if err != nil {
return fmt.Errorf("failed to marshal application genesis state: %w", err)
}
genDoc.AppState = appStateJSON
return genutil.ExportGenesisFile(genDoc, genFile)
},
}
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)")
cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts")
cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package main
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/crypto"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/common/cosmos"
)
func AddTssToGenesisCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "get-pubkey [tssKeyName] [Password]",
Short: "Get you node account",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
tssKeyName := args[0]
if len(args) == 1 {
args = append(args, "")
}
pubKeySet, err := GetPubKeySet(clientCtx, tssKeyName, args[1])
if err != nil {
return err
}
fmt.Println(pubKeySet.String())
return nil
},
}
return cmd
}
func GetPubKeySet(clientctx client.Context, tssAccountName, password string) (common.PubKeySet, error) {
pubkeySet := common.PubKeySet{
Secp256k1: "",
Ed25519: "",
}
//kb, err := GetKeyringKeybase(keyringPath, tssAccountName, password)
privKeyArmor, err := clientctx.Keyring.ExportPrivKeyArmor(tssAccountName, password)
if err != nil {
return pubkeySet, err
}
priKey, _, err := crypto.UnarmorDecryptPrivKey(privKeyArmor, password)
if err != nil {
return pubkeySet, fmt.Errorf("fail to unarmor private key: %w", err)
}
s, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, priKey.PubKey())
if err != nil {
return pubkeySet, err
}
pubkey, err := common.NewPubKey(s)
if err != nil {
return pubkeySet, err
}
pubkeySet.Secp256k1 = pubkey
return pubkeySet, nil
}
package main
import (
"fmt"
"os"
"strings"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/zeta-chain/zetacore/app"
cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config"
)
func main() {
cmdcfg.RegisterDenoms()
rootCmd, _ := NewRootCmd()
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
os.Exit(e.Code)
default:
processError(e)
os.Exit(1)
}
}
}
func processError(err error) {
// --ledger flag can't be used with Ethereum HD path
if strings.Contains(err.Error(), "cannot set custom bip32 path with ledger") {
printNotice([]string{
"note: --ledger flag can't be used with Ethereum HD path (used by default)",
"use --hd-path=\"\" in the command to use Cosmos HD path",
})
os.Exit(1)
}
}
func printNotice(messages []string) {
if len(messages) == 0 {
return
}
border := strings.Repeat("*", len(messages[0])+4) // 4 to account for padding
fmt.Println(border)
for _, message := range messages {
fmt.Printf("* %s \n", message)
}
fmt.Println(border)
}
package main
import (
"encoding/json"
"fmt"
"path/filepath"
"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authz "github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ethcommon "github.com/ethereum/go-ethereum/common"
ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/app"
"github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/common"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// Token distribution
// Validators Only = ValidatorTokens sent to their operator address
// Observer = ObserverTokens sent to their operator address + HotkeyTokens sent to their hotkey address
// HotkeyTokens are for operational expenses such as paying for gas fees
const (
ValidatorTokens = "100000000000000000000000"
ObserverTokens = "4100000000000000000000000"
HotkeyTokens = "1000000000000000000000"
keygenBlock = "keygen-block"
tssPubKey = "tss-pubkey"
)
func AddObserverAccountsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "add-observer-list [observer-list.json] ",
Short: "Add a list of observers to the observer mapper ,default path is ~/.zetacored/os_info/observer_info.json",
Args: cobra.MaximumNArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.Codec
serverCtx := server.GetServerContextFromCmd(cmd)
serverConfig := serverCtx.Config
defaultHome := app.DefaultNodeHome
defaultFile := filepath.Join(defaultHome, "os_info", "observer_info.json")
if len(args) == 0 {
args = append(args, defaultFile)
}
keyGenBlock, err := cmd.Flags().GetInt64(keygenBlock)
if err != nil {
return err
}
tssPubkey, err := cmd.Flags().GetString(tssPubKey)
if err != nil {
return err
}
if keyGenBlock == 0 && tssPubkey == "" {
panic("TSS pubkey is required if keygen block is set to 0")
}
file := args[0]
observerInfo, err := ParsefileToObserverDetails(file)
if err != nil {
return err
}
var observerMapper []*types.ObserverMapper
var grantAuthorizations []authz.GrantAuthorization
var nodeAccounts []*types.NodeAccount
var keygenPubKeys []string
observersForChain := map[int64][]string{}
// DefaultChainsList is based on Build Flags
supportedChains := common.DefaultChainsList()
var balances []banktypes.Balance
validatorTokens, ok := sdk.NewIntFromString(ValidatorTokens)
if !ok {
panic("Failed to parse string to int for observer")
}
hotkeyTokens, ok := sdk.NewIntFromString(HotkeyTokens)
if !ok {
panic("Failed to parse string to int for hotkey")
}
observerTokens, ok := sdk.NewIntFromString(ObserverTokens)
if !ok {
panic("Failed to parse string to int for hotkey")
}
ValidatorBalance := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, validatorTokens))
HotkeyBalance := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, hotkeyTokens))
ObserverBalance := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, observerTokens))
// Generate the grant authorizations and created observer list for chain
for _, info := range observerInfo {
if isValidatorOnly(info.IsObserver) {
balances = append(balances, banktypes.Balance{
Address: info.ObserverAddress,
Coins: ValidatorBalance,
})
continue
}
balances = append(balances, banktypes.Balance{
Address: info.ObserverAddress,
Coins: ValidatorBalance.Add(ObserverBalance...),
})
if info.ZetaClientGranteeAddress == "" || info.ObserverAddress == "" {
panic("ZetaClientGranteeAddress or ObserverAddress is empty")
}
grantAuthorizations = append(grantAuthorizations, generateGrants(info)...)
for _, chain := range supportedChains {
observersForChain[chain.ChainId] = append(observersForChain[chain.ChainId], info.ObserverAddress)
}
if info.ZetaClientGranteePubKey != "" {
pubkey, err := common.NewPubKey(info.ZetaClientGranteePubKey)
if err != nil {
panic(err)
}
pubkeySet := common.PubKeySet{
Secp256k1: pubkey,
Ed25519: "",
}
na := types.NodeAccount{
Operator: info.ObserverAddress,
GranteeAddress: info.ZetaClientGranteeAddress,
GranteePubkey: &pubkeySet,
NodeStatus: types.NodeStatus_Active,
}
nodeAccounts = append(nodeAccounts, &na)
}
balances = append(balances, banktypes.Balance{
Address: info.ZetaClientGranteeAddress,
Coins: HotkeyBalance,
})
keygenPubKeys = append(keygenPubKeys, info.ZetaClientGranteePubKey)
}
// Generate observer mappers for each chain
for chainID, observers := range observersForChain {
observers = removeDuplicate(observers)
chain := common.GetChainFromChainID(chainID)
mapper := types.ObserverMapper{
ObserverChain: chain,
ObserverList: observers,
}
observerMapper = append(observerMapper, &mapper)
}
genFile := serverConfig.GenesisFile()
appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile)
if err != nil {
return fmt.Errorf("failed to unmarshal genesis state: %w", err)
}
// Add node accounts to cross chain genesis state
zetaCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, appState)
if keyGenBlock == 0 {
operatorList := make([]string, len(nodeAccounts))
for i, nodeAccount := range nodeAccounts {
operatorList[i] = nodeAccount.Operator
}
tss := crosschaintypes.TSS{
TssPubkey: tssPubkey,
TssParticipantList: keygenPubKeys,
OperatorAddressList: operatorList,
FinalizedZetaHeight: 0,
KeyGenZetaHeight: 0,
}
zetaCrossChainGenState.Tss = &tss
}
// Add observers to observer genesis state
zetaObserverGenState := types.GetGenesisStateFromAppState(cdc, appState)
zetaObserverGenState.Observers = observerMapper
zetaObserverGenState.NodeAccountList = nodeAccounts
keyGenStatus := types.KeygenStatus_PendingKeygen
if keyGenBlock == 0 {
keyGenStatus = types.KeygenStatus_KeyGenSuccess
}
zetaObserverGenState.Keygen = &types.Keygen{
Status: keyGenStatus,
GranteePubkeys: keygenPubKeys,
BlockNumber: keyGenBlock,
}
// Add grant authorizations to authz genesis state
var authzGenState authz.GenesisState
if appState[authz.ModuleName] != nil {
err := cdc.UnmarshalJSON(appState[authz.ModuleName], &authzGenState)
if err != nil {
panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error()))
}
}
authzGenState.Authorization = grantAuthorizations
// Marshal modified states into genesis file
zetaCrossChainStateBz, err := json.Marshal(zetaCrossChainGenState)
if err != nil {
return fmt.Errorf("failed to marshal Observer List into Genesis File: %w", err)
}
zetaObserverStateBz, err := json.Marshal(zetaObserverGenState)
if err != nil {
return fmt.Errorf("failed to marshal Observer List into Genesis File: %w", err)
}
err = codectypes.UnpackInterfaces(authzGenState, cdc)
if err != nil {
return fmt.Errorf("failed to authz grants into upackeder: %w", err)
}
authZStateBz, err := cdc.MarshalJSON(&authzGenState)
if err != nil {
return fmt.Errorf("failed to authz grants into Genesis File: %w", err)
}
appState[types.ModuleName] = zetaObserverStateBz
appState[authz.ModuleName] = authZStateBz
appState[crosschaintypes.ModuleName] = zetaCrossChainStateBz
modifiedAppState, err := AddGenesisAccount(clientCtx, balances, appState)
if err != nil {
panic(err)
}
// Create new genesis file
appStateJSON, err := json.Marshal(modifiedAppState)
if err != nil {
return fmt.Errorf("failed to marshal application genesis state: %w", err)
}
genDoc.AppState = appStateJSON
return genutil.ExportGenesisFile(genDoc, genFile)
},
}
cmd.Flags().Int64(keygenBlock, 20, "set keygen block , default is 20")
cmd.Flags().String(tssPubKey, "", "set TSS pubkey if using older keygen")
return cmd
}
func removeDuplicate[T string | int](sliceList []T) []T {
allKeys := make(map[T]bool)
list := []T{}
for _, item := range sliceList {
if _, value := allKeys[item]; !value {
allKeys[item] = true
list = append(list, item)
}
}
return list
}
func generateGrants(info ObserverInfoReader) []authz.GrantAuthorization {
sdk.MustAccAddressFromBech32(info.ObserverAddress)
var grants []authz.GrantAuthorization
if info.ZetaClientGranteeAddress != "" {
sdk.MustAccAddressFromBech32(info.ZetaClientGranteeAddress)
grants = append(grants, addZetaClientGrants(grants, info)...)
}
if info.SpendGranteeAddress != "" {
sdk.MustAccAddressFromBech32(info.SpendGranteeAddress)
grants = append(grants, addSpendingGrants(grants, info)...)
}
if info.StakingGranteeAddress != "" {
sdk.MustAccAddressFromBech32(info.StakingGranteeAddress)
grants = append(grants, addStakingGrants(grants, info)...)
}
if info.GovGranteeAddress != "" {
sdk.MustAccAddressFromBech32(info.GovGranteeAddress)
grants = append(grants, addGovGrants(grants, info)...)
}
return grants
}
func addZetaClientGrants(grants []authz.GrantAuthorization, info ObserverInfoReader) []authz.GrantAuthorization {
txTypes := crosschaintypes.GetAllAuthzZetaclientTxTypes()
for _, txType := range txTypes {
auth, err := codectypes.NewAnyWithValue(authz.NewGenericAuthorization(txType))
if err != nil {
panic(err)
}
grants = append(grants, authz.GrantAuthorization{
Granter: info.ObserverAddress,
Grantee: info.ZetaClientGranteeAddress,
Authorization: auth,
Expiration: nil,
})
}
return grants
}
func addGovGrants(grants []authz.GrantAuthorization, info ObserverInfoReader) []authz.GrantAuthorization {
txTypes := []string{sdk.MsgTypeURL(&v1beta1.MsgVote{}),
sdk.MsgTypeURL(&v1beta1.MsgSubmitProposal{}),
sdk.MsgTypeURL(&v1beta1.MsgDeposit{}),
sdk.MsgTypeURL(&v1beta1.MsgVoteWeighted{}),
sdk.MsgTypeURL(&v1.MsgVote{}),
sdk.MsgTypeURL(&v1.MsgSubmitProposal{}),
sdk.MsgTypeURL(&v1.MsgDeposit{}),
sdk.MsgTypeURL(&v1.MsgVoteWeighted{}),
}
for _, txType := range txTypes {
auth, err := codectypes.NewAnyWithValue(authz.NewGenericAuthorization(txType))
if err != nil {
panic(err)
}
grants = append(grants, authz.GrantAuthorization{
Granter: info.ObserverAddress,
Grantee: info.GovGranteeAddress,
Authorization: auth,
Expiration: nil,
})
}
return grants
}
func addSpendingGrants(grants []authz.GrantAuthorization, info ObserverInfoReader) []authz.GrantAuthorization {
spendMaxTokens, ok := sdk.NewIntFromString(info.SpendMaxTokens)
if !ok {
panic("Failed to parse spend max tokens")
}
spendAuth, err := codectypes.NewAnyWithValue(&banktypes.SendAuthorization{
SpendLimit: sdk.NewCoins(sdk.NewCoin(config.BaseDenom, spendMaxTokens)),
})
if err != nil {
panic(err)
}
grants = append(grants, authz.GrantAuthorization{
Granter: info.ObserverAddress,
Grantee: info.SpendGranteeAddress,
Authorization: spendAuth,
Expiration: nil,
})
return grants
}
func addStakingGrants(grants []authz.GrantAuthorization, info ObserverInfoReader) []authz.GrantAuthorization {
stakingMaxTokens, ok := sdk.NewIntFromString(info.StakingMaxTokens)
if !ok {
panic("Failed to parse staking max tokens")
}
alllowList := stakingtypes.StakeAuthorization_AllowList{AllowList: &stakingtypes.StakeAuthorization_Validators{Address: info.StakingValidatorAllowList}}
stakingAuth, err := codectypes.NewAnyWithValue(&stakingtypes.StakeAuthorization{
MaxTokens: &sdk.Coin{Denom: config.BaseDenom, Amount: stakingMaxTokens},
Validators: &alllowList,
AuthorizationType: stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE,
})
if err != nil {
panic(err)
}
grants = append(grants, authz.GrantAuthorization{
Granter: info.ObserverAddress,
Grantee: info.StakingGranteeAddress,
Authorization: stakingAuth,
Expiration: nil,
})
delAuth, err := codectypes.NewAnyWithValue(&stakingtypes.StakeAuthorization{
MaxTokens: &sdk.Coin{Denom: config.BaseDenom, Amount: stakingMaxTokens},
Validators: &alllowList,
AuthorizationType: stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_UNDELEGATE,
})
if err != nil {
panic(err)
}
grants = append(grants, authz.GrantAuthorization{
Granter: info.ObserverAddress,
Grantee: info.StakingGranteeAddress,
Authorization: delAuth,
Expiration: nil,
})
reDelauth, err := codectypes.NewAnyWithValue(&stakingtypes.StakeAuthorization{
MaxTokens: &sdk.Coin{Denom: config.BaseDenom, Amount: stakingMaxTokens},
Validators: &alllowList,
AuthorizationType: stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_REDELEGATE,
})
if err != nil {
panic(err)
}
grants = append(grants, authz.GrantAuthorization{
Granter: info.ObserverAddress,
Grantee: info.StakingGranteeAddress,
Authorization: reDelauth,
Expiration: nil,
})
return grants
}
func AddGenesisAccount(clientCtx client.Context, balances []banktypes.Balance, appState map[string]json.RawMessage) (map[string]json.RawMessage, error) {
var genAccount authtypes.GenesisAccount
totalBalanceAdded := sdk.Coins{}
genAccounts := make([]authtypes.GenesisAccount, len(balances))
for i, balance := range balances {
totalBalanceAdded = totalBalanceAdded.Add(balance.Coins...)
accAddress := sdk.MustAccAddressFromBech32(balance.Address)
baseAccount := authtypes.NewBaseAccount(accAddress, nil, 0, 0)
genAccount = ðermint.EthAccount{
BaseAccount: baseAccount,
CodeHash: ethcommon.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
}
if err := genAccount.Validate(); err != nil {
return appState, fmt.Errorf("failed to validate new genesis account: %w", err)
}
genAccounts[i] = genAccount
}
authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState)
accs, err := authtypes.UnpackAccounts(authGenState.Accounts)
if err != nil {
return appState, fmt.Errorf("failed to get accounts from any: %w", err)
}
for _, genAc := range genAccounts {
addr := genAc.GetAddress()
if accs.Contains(addr) {
return appState, fmt.Errorf("cannot add account at existing address %s", addr)
}
accs = append(accs, genAc)
accs = authtypes.SanitizeGenesisAccounts(accs)
}
genAccs, err := authtypes.PackAccounts(accs)
if err != nil {
return appState, fmt.Errorf("failed to convert accounts into any's: %w", err)
}
authGenState.Accounts = genAccs
authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState)
if err != nil {
return appState, fmt.Errorf("failed to marshal auth genesis state: %w", err)
}
appState[authtypes.ModuleName] = authGenStateBz
bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState)
bankGenState.Balances = append(bankGenState.Balances, balances...)
bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances)
bankGenState.Supply = bankGenState.Supply.Add(totalBalanceAdded...)
bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState)
if err != nil {
return appState, fmt.Errorf("failed to marshal bank genesis state: %w", err)
}
appState[banktypes.ModuleName] = bankGenStateBz
return appState, nil
}
func isValidatorOnly(isObserver string) bool {
if isObserver == "y" {
return false
} else if isObserver == "n" {
return true
}
panic("Invalid Input for isObserver field, Check observer_info.json file")
}
package main
import (
"encoding/json"
"io/ioutil"
"path/filepath"
)
type ObserverInfoReader struct {
IsObserver string `json:"IsObserver"`
ObserverAddress string `json:"ObserverAddress"`
ZetaClientGranteeAddress string `json:"ZetaClientGranteeAddress,omitempty"`
StakingGranteeAddress string `json:"StakingGranteeAddress,omitempty"`
StakingMaxTokens string `json:"StakingMaxTokens,omitempty"`
StakingValidatorAllowList []string `json:"StakingValidatorAllowList,omitempty"`
SpendGranteeAddress string `json:"SpendGranteeAddress,omitempty"`
SpendMaxTokens string `json:"SpendMaxTokens,omitempty"`
GovGranteeAddress string `json:"GovGranteeAddress,omitempty"`
ZetaClientGranteePubKey string `json:"ZetaClientGranteePubKey,omitempty"`
}
func (o ObserverInfoReader) String() string {
s, err := json.MarshalIndent(o, "", "\t")
if err != nil {
return ""
}
return string(s)
}
func ParsefileToObserverDetails(fp string) ([]ObserverInfoReader, error) {
var observers []ObserverInfoReader
file, err := filepath.Abs(fp)
if err != nil {
return nil, err
}
file = filepath.Clean(file)
input, err := ioutil.ReadFile(file) // #nosec G304
if err != nil {
return nil, err
}
err = json.Unmarshal(input, &observers)
if err != nil {
return nil, err
}
return observers, nil
}
package main
import (
"errors"
"fmt"
"io"
"os"
"path/filepath"
appparams "github.com/cosmos/cosmos-sdk/simapp/params"
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
"github.com/evmos/ethermint/crypto/hd"
tmcfg "github.com/tendermint/tendermint/config"
"github.com/zeta-chain/zetacore/app"
zetacoredconfig "github.com/zeta-chain/zetacore/cmd/zetacored/config"
zevmserver "github.com/zeta-chain/zetacore/server"
servercfg "github.com/zeta-chain/zetacore/server/config"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/snapshots"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
ethermintclient "github.com/evmos/ethermint/client"
"github.com/spf13/cast"
"github.com/spf13/cobra"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
)
const EnvPrefix = "zetacore"
// NewRootCmd creates a new root command for wasmd. It is called once in the
// main function.
func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) {
encodingConfig := app.MakeEncodingConfig()
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub)
cfg.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub)
cfg.Seal()
initClientCtx := client.Context{}.
WithCodec(encodingConfig.Codec).
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithBroadcastMode(flags.BroadcastBlock).
WithHomeDir(app.DefaultNodeHome).
WithKeyringOptions(hd.EthSecp256k1Option()).
WithViper(EnvPrefix)
rootCmd := &cobra.Command{
Use: version.AppName,
Short: "Zetacore Daemon (server)",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())
initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags())
if err != nil {
return err
}
initClientCtx, err = config.ReadFromClientConfig(initClientCtx)
if err != nil {
return err
}
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}
customAppTemplate, customAppConfig := initAppConfig()
return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, initTmConfig())
},
}
initRootCmd(rootCmd, encodingConfig)
return rootCmd, encodingConfig
}
// initAppConfig helps to override default appConfig template and configs.
// return "", nil if no custom configuration is required for the application.
func initAppConfig() (string, interface{}) {
return servercfg.AppConfig(zetacoredconfig.BaseDenom)
}
// initTmConfig overrides the default Tendermint config
func initTmConfig() *tmcfg.Config {
cfg := tmcfg.DefaultConfig()
// use mempool version 1 to enable tx priority
if cfg.Mempool != nil {
cfg.Mempool.Version = tmcfg.MempoolV1
}
return cfg
}
func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) {
rootCmd.AddCommand(
ethermintclient.ValidateChainID(
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
AddGenesisAccountCmd(app.DefaultNodeHome),
AddObserverAccountsCmd(),
AddTssToGenesisCmd(),
CollectObserverInfoCmd(),
AddrConversionCmd(),
tmcli.NewCompletionCmd(rootCmd, true),
ethermintclient.NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
config.Cmd(),
)
ac := appCreator{
encCfg: encodingConfig,
}
zevmserver.AddCommands(rootCmd, zevmserver.NewDefaultStartOptions(ac.newApp, app.DefaultNodeHome), ac.appExport, addModuleInitFlags)
// the ethermintserver one supercedes the sdk one
//server.AddCommands(rootCmd, app.DefaultNodeHome, ac.newApp, ac.createSimappAndExport, addModuleInitFlags)
// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
rpc.StatusCommand(),
queryCommand(),
txCommand(),
ethermintclient.KeyCommands(app.DefaultNodeHome),
)
// replace the default hd-path for the key add command with Ethereum HD Path
if err := SetEthereumHDPath(rootCmd); err != nil {
fmt.Printf("warning: unable to set default HD path: %v\n", err)
}
rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec))
}
func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
}
func queryCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "query",
Aliases: []string{"q"},
Short: "Querying subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
authcmd.GetAccountCmd(),
rpc.ValidatorCommand(),
rpc.BlockCommand(),
authcmd.QueryTxsByEventsCmd(),
authcmd.QueryTxCmd(),
)
app.ModuleBasics.AddQueryCommands(cmd)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")
return cmd
}
func txCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "tx",
Short: "Transactions subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
authcmd.GetSignCommand(),
authcmd.GetSignBatchCommand(),
authcmd.GetMultiSignCommand(),
authcmd.GetMultiSignBatchCmd(),
authcmd.GetValidateSignaturesCommand(),
flags.LineBreak,
authcmd.GetBroadcastCommand(),
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
)
app.ModuleBasics.AddTxCommands(cmd)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")
return cmd
}
type appCreator struct {
encCfg appparams.EncodingConfig
}
func (ac appCreator) newApp(
logger log.Logger,
db dbm.DB,
traceStore io.Writer,
appOpts servertypes.AppOptions,
) servertypes.Application {
var cache sdk.MultiStorePersistentCache
if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) {
cache = store.NewCommitKVStoreCacheManager()
}
skipUpgradeHeights := make(map[int64]bool)
for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
skipUpgradeHeights[int64(h)] = true
}
pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts)
if err != nil {
panic(err)
}
snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots")
snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir)
if err != nil {
panic(err)
}
snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir)
if err != nil {
panic(err)
}
snapshotOptions := snapshottypes.NewSnapshotOptions(
cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)),
cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)),
)
return app.New(logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
//cosmoscmd.EncodingConfig(ac.encCfg),
ac.encCfg,
appOpts,
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))),
baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))),
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))),
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))),
)
}
// appExport creates a new simapp (optionally at a given height)
func (ac appCreator) appExport(
logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string,
appOpts servertypes.AppOptions,
) (servertypes.ExportedApp, error) {
var anApp *app.App
homePath, ok := appOpts.Get(flags.FlagHome).(string)
if !ok || homePath == "" {
return servertypes.ExportedApp{}, errors.New("application home not set")
}
if height != -1 {
anApp = app.New(
logger,
db,
traceStore,
false,
map[int64]bool{},
homePath,
uint(1),
ac.encCfg,
appOpts,
)
if err := anApp.LoadHeight(height); err != nil {
return servertypes.ExportedApp{}, err
}
} else {
anApp = app.New(
logger,
db,
traceStore,
true,
map[int64]bool{},
homePath,
uint(1),
ac.encCfg,
appOpts,
)
}
return anApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs)
}
package common
import (
"fmt"
"strings"
eth "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/common/cosmos"
)
type Address string
var NoAddress Address
var (
DeadAddress = eth.HexToAddress("0xdEAD000000000000000042069420694206942069")
)
const ETHAddressLen = 42
// NewAddress create a new Address. Supports Ethereum, BSC, Polygon
func NewAddress(address string, chain Chain) (Address, error) {
// Check is eth address
if IsEVMChain(chain.ChainId) {
if eth.IsHexAddress(address) {
return Address(address), nil
}
}
return NoAddress, fmt.Errorf("address format not supported: %s", address)
}
func (addr Address) AccAddress() (cosmos.AccAddress, error) {
return cosmos.AccAddressFromBech32(addr.String())
}
func (addr Address) Equals(addr2 Address) bool {
return strings.EqualFold(addr.String(), addr2.String())
}
func (addr Address) IsEmpty() bool {
return strings.TrimSpace(addr.String()) == ""
}
func (addr Address) String() string {
return string(addr)
}
package common
type TxType string
const (
InboundVoter TxType = "InboundVoter"
OutboundVoter TxType = "OutboundVoter"
NonceVoter TxType = "NonceVoter"
GasPriceVoter TxType = "GasPriceVoter"
)
func (t TxType) String() string {
return string(t)
}
type KeyType string
const (
TssSignerKey KeyType = "tss_signer"
ValidatorGranteeKey KeyType = "validator_grantee"
ZetaClientGranteeKey KeyType = "zetaclient_grantee"
)
func GetAllKeyTypes() []KeyType {
return []KeyType{ValidatorGranteeKey, ZetaClientGranteeKey, TssSignerKey}
}
func (k KeyType) String() string {
return string(k)
}
package common
import (
"fmt"
"strings"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
ethcommon "github.com/ethereum/go-ethereum/common"
)
var (
SigningAlgoSecp256k1 = SigninAlgo("secp256k1")
SigningAlgoEd25519 = SigninAlgo("ed25519")
)
// return the ChainName from a string
// if no such name exists, returns the empty chain name: ChainName_empty
func ParseChainName(chain string) ChainName {
c := ChainName_value[chain]
return ChainName(c)
}
type SigninAlgo string
// Chain is an alias of string , represent a block chain
//type Chain string
// Chains represent a slice of Chain
type Chains []Chain
// Equals compare two chain to see whether they represent the same chain
func (chain Chain) IsEqual(c Chain) bool {
if chain.ChainName == c.ChainName && chain.ChainId == c.ChainId {
return true
}
return false
}
func (chain Chain) IsZetaChain() bool {
return chain.IsEqual(ZetaChain())
}
func (chain Chain) IsExternalChain() bool {
return !chain.IsEqual(ZetaChain())
}
// bytes representations of address
// on EVM chain, it is 20Bytes
// on Bitcoin chain, it is P2WPKH address, []byte(bech32 encoded string)
func (chain Chain) EncodeAddress(b []byte) (string, error) {
if IsEVMChain(chain.ChainId) {
addr := ethcommon.BytesToAddress(b)
if addr == (ethcommon.Address{}) {
return "", fmt.Errorf("invalid EVM address")
}
return addr.Hex(), nil
} else if IsBitcoinChain(chain.ChainId) {
addrStr := string(b)
chainParams, err := GetBTCChainParams(chain.ChainId)
if err != nil {
return "", err
}
_, err = btcutil.DecodeAddress(addrStr, chainParams)
if err != nil {
return "", err
}
return addrStr, nil
}
return "", fmt.Errorf("chain (%d) not supported", chain.ChainId)
}
func (chain Chain) BTCAddressFromWitnessProgram(witnessProgram []byte) (string, error) {
chainParams, err := GetBTCChainParams(chain.ChainId)
if err != nil {
return "", err
}
address, err := btcutil.NewAddressWitnessPubKeyHash(witnessProgram, chainParams)
if err != nil {
return "", err
}
return address.EncodeAddress(), nil
}
// DecodeAddress decode the address string to bytes
func (chain Chain) DecodeAddress(addr string) ([]byte, error) {
if IsEVMChain(chain.ChainId) {
return ethcommon.HexToAddress(addr).Bytes(), nil
} else if IsBitcoinChain(chain.ChainId) {
return []byte(addr), nil
}
return nil, fmt.Errorf("chain (%d) not supported", chain.ChainId)
}
func IsEVMChain(chainID int64) bool {
return chainID == 5 || // Goerli
chainID == 80001 || // Polygon mumbai
chainID == 97 || // BSC testnet
chainID == 1001 || // klaytn baobab
chainID == 1337 || // eth privnet
chainID == 1 || // eth mainnet
chainID == 56 || // bsc mainnet
chainID == 137 // polygon mainnet
}
func IsHeaderSupportedEvmChain(chainID int64) bool {
return chainID == 5 || // Goerli
chainID == 97 || // BSC testnet
chainID == 1337 || // eth privnet
chainID == 1 || // eth mainnet
chainID == 56 // bsc mainnet
}
func (chain Chain) IsKlaytnChain() bool {
return chain.ChainId == 1001
}
// SupportMerkleProof returns true if the chain supports block header-based verification
func (chain Chain) SupportMerkleProof() bool {
return IsEVMChain(chain.ChainId) || IsBitcoinChain(chain.ChainId)
}
func IsBitcoinChain(chainID int64) bool {
return chainID == 18444 || // regtest
chainID == 18332 || //testnet
chainID == 8332 // mainnet
}
func IsEthereumChain(chainID int64) bool {
return chainID == 1 || // eth mainnet
chainID == 5 || // Goerli
chainID == 1337 // eth privnet
}
// IsEmpty is to determinate whether the chain is empty
func (chain Chain) IsEmpty() bool {
return strings.TrimSpace(chain.String()) == ""
}
// Has check whether chain c is in the list
func (chains Chains) Has(c Chain) bool {
for _, ch := range chains {
if ch.IsEqual(c) {
return true
}
}
return false
}
// Distinct return a distinct set of chains, no duplicates
func (chains Chains) Distinct() Chains {
var newChains Chains
for _, chain := range chains {
if !newChains.Has(chain) {
newChains = append(newChains, chain)
}
}
return newChains
}
func (chains Chains) Strings() []string {
strings := make([]string, len(chains))
for i, c := range chains {
strings[i] = c.String()
}
return strings
}
func GetChainFromChainName(chainName ChainName) *Chain {
chains := DefaultChainsList()
for _, chain := range chains {
if chainName == chain.ChainName {
return chain
}
}
return nil
}
func GetChainFromChainID(chainID int64) *Chain {
chains := DefaultChainsList()
for _, chain := range chains {
if chainID == chain.ChainId {
return chain
}
}
return nil
}
func GetChainNameFromChainID(chainID int64) (string, error) {
chain := GetChainFromChainID(chainID)
if chain == nil {
return "", fmt.Errorf("chain %d not found", chainID)
}
return chain.GetChainName().String(), nil
}
func GetBTCChainParams(chainID int64) (*chaincfg.Params, error) {
switch chainID {
case 18444:
return &chaincfg.RegressionNetParams, nil
case 18332:
return &chaincfg.TestNet3Params, nil
case 8332:
return &chaincfg.MainNetParams, nil
default:
return nil, fmt.Errorf("error chainID %d is not a Bitcoin chain", chainID)
}
}
package common
import (
"os"
"strings"
)
// ChainNetwork is to indicate which chain environment THORNode are working with
type ChainNetwork uint8
const (
// TestNet network for test
TestNet ChainNetwork = iota
// MainNet network for main net
MainNet
// MockNet network for main net
MockNet
)
// GetCurrentChainNetwork determinate what kind of network currently it is working with
func GetCurrentChainNetwork() ChainNetwork {
if strings.EqualFold(os.Getenv("NET"), "mocknet") {
return MockNet
}
if strings.EqualFold(os.Getenv("NET"), "testnet") {
return TestNet
}
return MainNet
}
// Soft Equals check is mainnet == mainet, or (testnet/mocknet == testnet/mocknet)
func (net ChainNetwork) SoftEquals(net2 ChainNetwork) bool {
if net == MainNet && net2 == MainNet {
return true
}
if net != MainNet && net2 != MainNet {
return true
}
return false
}
package common
import (
"fmt"
"strconv"
)
func GetCoinType(coin string) (CoinType, error) {
coinInt, err := strconv.ParseInt(coin, 10, 32)
if err != nil {
return CoinType_Cmd, err
}
if coinInt < 0 || coinInt > 3 {
return CoinType_Cmd, fmt.Errorf("invalid coin type %d", coinInt)
}
// #nosec G701 always in range
return CoinType(coinInt), nil
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: common/common.proto
package common
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
bitcoin "github.com/zeta-chain/zetacore/common/bitcoin"
ethereum "github.com/zeta-chain/zetacore/common/ethereum"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ReceiveStatus int32
const (
ReceiveStatus_Created ReceiveStatus = 0
ReceiveStatus_Success ReceiveStatus = 1
ReceiveStatus_Failed ReceiveStatus = 2
)
var ReceiveStatus_name = map[int32]string{
0: "Created",
1: "Success",
2: "Failed",
}
var ReceiveStatus_value = map[string]int32{
"Created": 0,
"Success": 1,
"Failed": 2,
}
func (x ReceiveStatus) String() string {
return proto.EnumName(ReceiveStatus_name, int32(x))
}
func (ReceiveStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{0}
}
type CoinType int32
const (
CoinType_Zeta CoinType = 0
CoinType_Gas CoinType = 1
CoinType_ERC20 CoinType = 2
CoinType_Cmd CoinType = 3
)
var CoinType_name = map[int32]string{
0: "Zeta",
1: "Gas",
2: "ERC20",
3: "Cmd",
}
var CoinType_value = map[string]int32{
"Zeta": 0,
"Gas": 1,
"ERC20": 2,
"Cmd": 3,
}
func (x CoinType) String() string {
return proto.EnumName(CoinType_name, int32(x))
}
func (CoinType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{1}
}
type ChainName int32
const (
ChainName_empty ChainName = 0
ChainName_eth_mainnet ChainName = 1
ChainName_zeta_mainnet ChainName = 2
ChainName_btc_mainnet ChainName = 3
ChainName_polygon_mainnet ChainName = 4
ChainName_bsc_mainnet ChainName = 5
// Testnet
ChainName_goerli_testnet ChainName = 6
ChainName_mumbai_testnet ChainName = 7
ChainName_ganache_testnet ChainName = 8
ChainName_baobab_testnet ChainName = 9
ChainName_bsc_testnet ChainName = 10
ChainName_zeta_testnet ChainName = 11
ChainName_btc_testnet ChainName = 12
// LocalNet
// zeta_localnet = 13;
ChainName_goerli_localnet ChainName = 14
ChainName_btc_regtest ChainName = 15
)
var ChainName_name = map[int32]string{
0: "empty",
1: "eth_mainnet",
2: "zeta_mainnet",
3: "btc_mainnet",
4: "polygon_mainnet",
5: "bsc_mainnet",
6: "goerli_testnet",
7: "mumbai_testnet",
8: "ganache_testnet",
9: "baobab_testnet",
10: "bsc_testnet",
11: "zeta_testnet",
12: "btc_testnet",
14: "goerli_localnet",
15: "btc_regtest",
}
var ChainName_value = map[string]int32{
"empty": 0,
"eth_mainnet": 1,
"zeta_mainnet": 2,
"btc_mainnet": 3,
"polygon_mainnet": 4,
"bsc_mainnet": 5,
"goerli_testnet": 6,
"mumbai_testnet": 7,
"ganache_testnet": 8,
"baobab_testnet": 9,
"bsc_testnet": 10,
"zeta_testnet": 11,
"btc_testnet": 12,
"goerli_localnet": 14,
"btc_regtest": 15,
}
func (x ChainName) String() string {
return proto.EnumName(ChainName_name, int32(x))
}
func (ChainName) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{2}
}
// PubKeySet contains two pub keys , secp256k1 and ed25519
type PubKeySet struct {
Secp256k1 PubKey `protobuf:"bytes,1,opt,name=secp256k1,proto3,casttype=PubKey" json:"secp256k1,omitempty"`
Ed25519 PubKey `protobuf:"bytes,2,opt,name=ed25519,proto3,casttype=PubKey" json:"ed25519,omitempty"`
}
func (m *PubKeySet) Reset() { *m = PubKeySet{} }
func (m *PubKeySet) String() string { return proto.CompactTextString(m) }
func (*PubKeySet) ProtoMessage() {}
func (*PubKeySet) Descriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{0}
}
func (m *PubKeySet) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *PubKeySet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_PubKeySet.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *PubKeySet) XXX_Merge(src proto.Message) {
xxx_messageInfo_PubKeySet.Merge(m, src)
}
func (m *PubKeySet) XXX_Size() int {
return m.Size()
}
func (m *PubKeySet) XXX_DiscardUnknown() {
xxx_messageInfo_PubKeySet.DiscardUnknown(m)
}
var xxx_messageInfo_PubKeySet proto.InternalMessageInfo
func (m *PubKeySet) GetSecp256k1() PubKey {
if m != nil {
return m.Secp256k1
}
return ""
}
func (m *PubKeySet) GetEd25519() PubKey {
if m != nil {
return m.Ed25519
}
return ""
}
type Chain struct {
ChainName ChainName `protobuf:"varint,1,opt,name=chain_name,json=chainName,proto3,enum=common.ChainName" json:"chain_name,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *Chain) Reset() { *m = Chain{} }
func (m *Chain) String() string { return proto.CompactTextString(m) }
func (*Chain) ProtoMessage() {}
func (*Chain) Descriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{1}
}
func (m *Chain) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Chain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Chain.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Chain) XXX_Merge(src proto.Message) {
xxx_messageInfo_Chain.Merge(m, src)
}
func (m *Chain) XXX_Size() int {
return m.Size()
}
func (m *Chain) XXX_DiscardUnknown() {
xxx_messageInfo_Chain.DiscardUnknown(m)
}
var xxx_messageInfo_Chain proto.InternalMessageInfo
func (m *Chain) GetChainName() ChainName {
if m != nil {
return m.ChainName
}
return ChainName_empty
}
func (m *Chain) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
type BlockHeader struct {
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
ParentHash []byte `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
ChainId int64 `protobuf:"varint,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
// chain specific header
Header HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"`
}
func (m *BlockHeader) Reset() { *m = BlockHeader{} }
func (m *BlockHeader) String() string { return proto.CompactTextString(m) }
func (*BlockHeader) ProtoMessage() {}
func (*BlockHeader) Descriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{2}
}
func (m *BlockHeader) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *BlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_BlockHeader.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *BlockHeader) XXX_Merge(src proto.Message) {
xxx_messageInfo_BlockHeader.Merge(m, src)
}
func (m *BlockHeader) XXX_Size() int {
return m.Size()
}
func (m *BlockHeader) XXX_DiscardUnknown() {
xxx_messageInfo_BlockHeader.DiscardUnknown(m)
}
var xxx_messageInfo_BlockHeader proto.InternalMessageInfo
func (m *BlockHeader) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
func (m *BlockHeader) GetHash() []byte {
if m != nil {
return m.Hash
}
return nil
}
func (m *BlockHeader) GetParentHash() []byte {
if m != nil {
return m.ParentHash
}
return nil
}
func (m *BlockHeader) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *BlockHeader) GetHeader() HeaderData {
if m != nil {
return m.Header
}
return HeaderData{}
}
type HeaderData struct {
// Types that are valid to be assigned to Data:
//
// *HeaderData_EthereumHeader
// *HeaderData_BitcoinHeader
Data isHeaderData_Data `protobuf_oneof:"data"`
}
func (m *HeaderData) Reset() { *m = HeaderData{} }
func (m *HeaderData) String() string { return proto.CompactTextString(m) }
func (*HeaderData) ProtoMessage() {}
func (*HeaderData) Descriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{3}
}
func (m *HeaderData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *HeaderData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_HeaderData.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *HeaderData) XXX_Merge(src proto.Message) {
xxx_messageInfo_HeaderData.Merge(m, src)
}
func (m *HeaderData) XXX_Size() int {
return m.Size()
}
func (m *HeaderData) XXX_DiscardUnknown() {
xxx_messageInfo_HeaderData.DiscardUnknown(m)
}
var xxx_messageInfo_HeaderData proto.InternalMessageInfo
type isHeaderData_Data interface {
isHeaderData_Data()
MarshalTo([]byte) (int, error)
Size() int
}
type HeaderData_EthereumHeader struct {
EthereumHeader []byte `protobuf:"bytes,1,opt,name=ethereum_header,json=ethereumHeader,proto3,oneof" json:"ethereum_header,omitempty"`
}
type HeaderData_BitcoinHeader struct {
BitcoinHeader []byte `protobuf:"bytes,2,opt,name=bitcoin_header,json=bitcoinHeader,proto3,oneof" json:"bitcoin_header,omitempty"`
}
func (*HeaderData_EthereumHeader) isHeaderData_Data() {}
func (*HeaderData_BitcoinHeader) isHeaderData_Data() {}
func (m *HeaderData) GetData() isHeaderData_Data {
if m != nil {
return m.Data
}
return nil
}
func (m *HeaderData) GetEthereumHeader() []byte {
if x, ok := m.GetData().(*HeaderData_EthereumHeader); ok {
return x.EthereumHeader
}
return nil
}
func (m *HeaderData) GetBitcoinHeader() []byte {
if x, ok := m.GetData().(*HeaderData_BitcoinHeader); ok {
return x.BitcoinHeader
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*HeaderData) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*HeaderData_EthereumHeader)(nil),
(*HeaderData_BitcoinHeader)(nil),
}
}
type Proof struct {
// Types that are valid to be assigned to Proof:
//
// *Proof_EthereumProof
// *Proof_BitcoinProof
Proof isProof_Proof `protobuf_oneof:"proof"`
}
func (m *Proof) Reset() { *m = Proof{} }
func (m *Proof) String() string { return proto.CompactTextString(m) }
func (*Proof) ProtoMessage() {}
func (*Proof) Descriptor() ([]byte, []int) {
return fileDescriptor_8f954d82c0b891f6, []int{4}
}
func (m *Proof) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Proof.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Proof) XXX_Merge(src proto.Message) {
xxx_messageInfo_Proof.Merge(m, src)
}
func (m *Proof) XXX_Size() int {
return m.Size()
}
func (m *Proof) XXX_DiscardUnknown() {
xxx_messageInfo_Proof.DiscardUnknown(m)
}
var xxx_messageInfo_Proof proto.InternalMessageInfo
type isProof_Proof interface {
isProof_Proof()
MarshalTo([]byte) (int, error)
Size() int
}
type Proof_EthereumProof struct {
EthereumProof *ethereum.Proof `protobuf:"bytes,1,opt,name=ethereum_proof,json=ethereumProof,proto3,oneof" json:"ethereum_proof,omitempty"`
}
type Proof_BitcoinProof struct {
BitcoinProof *bitcoin.Proof `protobuf:"bytes,2,opt,name=bitcoin_proof,json=bitcoinProof,proto3,oneof" json:"bitcoin_proof,omitempty"`
}
func (*Proof_EthereumProof) isProof_Proof() {}
func (*Proof_BitcoinProof) isProof_Proof() {}
func (m *Proof) GetProof() isProof_Proof {
if m != nil {
return m.Proof
}
return nil
}
func (m *Proof) GetEthereumProof() *ethereum.Proof {
if x, ok := m.GetProof().(*Proof_EthereumProof); ok {
return x.EthereumProof
}
return nil
}
func (m *Proof) GetBitcoinProof() *bitcoin.Proof {
if x, ok := m.GetProof().(*Proof_BitcoinProof); ok {
return x.BitcoinProof
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Proof) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Proof_EthereumProof)(nil),
(*Proof_BitcoinProof)(nil),
}
}
func init() {
proto.RegisterEnum("common.ReceiveStatus", ReceiveStatus_name, ReceiveStatus_value)
proto.RegisterEnum("common.CoinType", CoinType_name, CoinType_value)
proto.RegisterEnum("common.ChainName", ChainName_name, ChainName_value)
proto.RegisterType((*PubKeySet)(nil), "common.PubKeySet")
proto.RegisterType((*Chain)(nil), "common.Chain")
proto.RegisterType((*BlockHeader)(nil), "common.BlockHeader")
proto.RegisterType((*HeaderData)(nil), "common.HeaderData")
proto.RegisterType((*Proof)(nil), "common.Proof")
}
func init() { proto.RegisterFile("common/common.proto", fileDescriptor_8f954d82c0b891f6) }
var fileDescriptor_8f954d82c0b891f6 = []byte{
// 682 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x94, 0xcd, 0x6a, 0xdb, 0x4a,
0x14, 0x80, 0x25, 0xff, 0xeb, 0xd8, 0xb1, 0x75, 0x27, 0x97, 0x7b, 0x73, 0xc3, 0x45, 0x0e, 0xa6,
0xa5, 0x69, 0xa0, 0x4e, 0xe2, 0xe2, 0xfe, 0xd0, 0x45, 0xc1, 0xee, 0x4f, 0x4a, 0xa1, 0x04, 0x39,
0xab, 0x6c, 0xcc, 0x48, 0x3a, 0x95, 0x44, 0x2c, 0x8d, 0x91, 0xc7, 0x05, 0x77, 0xd7, 0x37, 0xe8,
0x2b, 0x14, 0x0a, 0xed, 0xa3, 0x64, 0x99, 0x65, 0x57, 0xa1, 0x38, 0x6f, 0xd1, 0x55, 0x99, 0xd1,
0x8c, 0x9c, 0xae, 0x74, 0xe6, 0x3b, 0xdf, 0x39, 0x67, 0x46, 0x1a, 0x04, 0xdb, 0x3e, 0x4b, 0x12,
0x96, 0x1e, 0xe6, 0x8f, 0xfe, 0x3c, 0x63, 0x9c, 0x91, 0x5a, 0xbe, 0xda, 0xfd, 0x5f, 0x25, 0xbd,
0x98, 0xfb, 0x2c, 0x2e, 0x9e, 0xb9, 0xb5, 0xeb, 0xa8, 0x2c, 0xf2, 0x08, 0x33, 0x5c, 0x26, 0x45,
0xa0, 0xf2, 0x7f, 0x87, 0x2c, 0x64, 0x32, 0x3c, 0x14, 0x51, 0x4e, 0x7b, 0x11, 0x58, 0xa7, 0x4b,
0xef, 0x2d, 0xae, 0x26, 0xc8, 0xc9, 0x10, 0xac, 0x05, 0xfa, 0xf3, 0xc1, 0xf0, 0xd1, 0xc5, 0xf1,
0x8e, 0xb9, 0x67, 0xee, 0x5b, 0xa3, 0x7f, 0xd7, 0xd7, 0x5d, 0x6b, 0xa2, 0xe1, 0xaf, 0xeb, 0x6e,
0x2d, 0xd7, 0xdd, 0x8d, 0x49, 0xee, 0x40, 0x1d, 0x83, 0xc1, 0x70, 0x78, 0xfc, 0x74, 0xa7, 0x24,
0x8b, 0xe0, 0x96, 0xa7, 0x53, 0xbd, 0x33, 0xa8, 0x8e, 0x23, 0x1a, 0xa7, 0xe4, 0x08, 0xc0, 0x17,
0xc1, 0x34, 0xa5, 0x09, 0xca, 0x31, 0xed, 0xc1, 0x5f, 0x7d, 0x75, 0x62, 0xa9, 0xbc, 0xa3, 0x09,
0xba, 0x96, 0xaf, 0x43, 0xf2, 0x1f, 0x34, 0xf2, 0x8a, 0x38, 0x90, 0x13, 0xca, 0x6e, 0x5d, 0xae,
0xdf, 0x04, 0xbd, 0x6f, 0x26, 0x34, 0x47, 0x33, 0xe6, 0x5f, 0x9c, 0x20, 0x0d, 0x30, 0x23, 0xff,
0x40, 0x2d, 0xc2, 0x38, 0x8c, 0xb8, 0x6c, 0x5c, 0x76, 0xd5, 0x8a, 0x10, 0xa8, 0x44, 0x74, 0x11,
0xc9, 0xf2, 0x96, 0x2b, 0x63, 0xd2, 0x85, 0xe6, 0x9c, 0x66, 0x98, 0xf2, 0xa9, 0x4c, 0x95, 0x65,
0x0a, 0x72, 0x74, 0x22, 0x84, 0xdb, 0x73, 0x2b, 0x7f, 0xcc, 0x25, 0x47, 0x62, 0x8e, 0x98, 0xb8,
0x53, 0xdd, 0x33, 0xf7, 0x9b, 0x03, 0xa2, 0x0f, 0x90, 0xef, 0xe3, 0x05, 0xe5, 0x74, 0x54, 0xb9,
0xbc, 0xee, 0x1a, 0xae, 0xf2, 0x7a, 0x11, 0xc0, 0x26, 0x47, 0xee, 0x43, 0x47, 0x7f, 0x9f, 0xa9,
0x6a, 0x24, 0x36, 0xdc, 0x3a, 0x31, 0xdc, 0xb6, 0x4e, 0xa8, 0x23, 0xdd, 0x83, 0xb6, 0xfa, 0xd2,
0xda, 0x2c, 0x29, 0x73, 0x4b, 0xf1, 0x5c, 0x1c, 0xd5, 0xa0, 0x12, 0x50, 0x4e, 0x7b, 0x9f, 0x4c,
0xa8, 0x9e, 0x66, 0x8c, 0xbd, 0x27, 0x4f, 0xa0, 0x68, 0x36, 0x9d, 0x0b, 0x22, 0x87, 0x34, 0x07,
0x9d, 0x7e, 0x71, 0x39, 0xa4, 0x28, 0x7a, 0x69, 0x92, 0x57, 0x0e, 0x41, 0x37, 0x57, 0x85, 0x25,
0x59, 0xd8, 0xee, 0xeb, 0x4b, 0xa7, 0xeb, 0x5a, 0x0a, 0xc8, 0xf5, 0xa8, 0x0e, 0x55, 0xa9, 0x1f,
0x3c, 0x83, 0x2d, 0x17, 0x7d, 0x8c, 0x3f, 0xe0, 0x84, 0x53, 0xbe, 0x5c, 0x90, 0x26, 0xd4, 0xc7,
0x19, 0x52, 0x8e, 0x81, 0x6d, 0x88, 0xc5, 0x64, 0xe9, 0xfb, 0xb8, 0x58, 0xd8, 0x26, 0x01, 0xa8,
0xbd, 0xa2, 0xf1, 0x0c, 0x03, 0xbb, 0xb4, 0x5b, 0xf9, 0xfe, 0xd5, 0x31, 0x0f, 0x1e, 0x43, 0x63,
0xcc, 0xe2, 0xf4, 0x6c, 0x35, 0x47, 0xd2, 0x80, 0xca, 0x39, 0x72, 0x6a, 0x1b, 0xa4, 0x0e, 0xe5,
0xd7, 0x54, 0x14, 0x58, 0x50, 0x7d, 0xe9, 0x8e, 0x07, 0x47, 0x76, 0x49, 0xb0, 0x71, 0x12, 0xd8,
0x65, 0x55, 0xf8, 0xa5, 0x04, 0x56, 0x71, 0x83, 0x84, 0x87, 0xc9, 0x9c, 0xaf, 0x6c, 0x83, 0x74,
0xa0, 0x89, 0x3c, 0x9a, 0x26, 0x34, 0x4e, 0x53, 0xe4, 0xb6, 0x49, 0x6c, 0x68, 0x7d, 0x44, 0x4e,
0x0b, 0x52, 0x12, 0x8a, 0xc7, 0xfd, 0x02, 0x94, 0xc9, 0x36, 0x74, 0xe6, 0x6c, 0xb6, 0x0a, 0x59,
0x5a, 0xc0, 0x8a, 0xb4, 0x16, 0x1b, 0xab, 0x4a, 0x08, 0xb4, 0x43, 0x86, 0xd9, 0x2c, 0x9e, 0x72,
0x5c, 0x70, 0xc1, 0x6a, 0x82, 0x25, 0xcb, 0xc4, 0xa3, 0x1b, 0x56, 0x17, 0xdd, 0x42, 0x9a, 0x52,
0x3f, 0xc2, 0x02, 0x36, 0x84, 0xe8, 0x51, 0xe6, 0x51, 0xaf, 0x60, 0x96, 0x9e, 0xa0, 0x01, 0x14,
0x5b, 0xd5, 0xa4, 0xa9, 0xb7, 0xaa, 0x41, 0x4b, 0x36, 0xcf, 0x37, 0x31, 0x63, 0x3e, 0x9d, 0x09,
0xd8, 0xd6, 0x56, 0x86, 0xa1, 0x10, 0xed, 0x4e, 0xfe, 0x8e, 0x46, 0xcf, 0x2f, 0xd7, 0x8e, 0x79,
0xb5, 0x76, 0xcc, 0x9f, 0x6b, 0xc7, 0xfc, 0x7c, 0xe3, 0x18, 0x57, 0x37, 0x8e, 0xf1, 0xe3, 0xc6,
0x31, 0xce, 0xef, 0x86, 0x31, 0x8f, 0x96, 0x9e, 0xb8, 0xc9, 0x87, 0x62, 0xe2, 0x03, 0x79, 0xd9,
0x65, 0xe8, 0xb3, 0x0c, 0xd5, 0x4f, 0xc9, 0xab, 0xc9, 0x3f, 0xc7, 0xc3, 0xdf, 0x01, 0x00, 0x00,
0xff, 0xff, 0x61, 0x31, 0x96, 0x1f, 0xac, 0x04, 0x00, 0x00,
}
func (m *PubKeySet) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *PubKeySet) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PubKeySet) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Ed25519) > 0 {
i -= len(m.Ed25519)
copy(dAtA[i:], m.Ed25519)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Ed25519)))
i--
dAtA[i] = 0x12
}
if len(m.Secp256k1) > 0 {
i -= len(m.Secp256k1)
copy(dAtA[i:], m.Secp256k1)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Secp256k1)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Chain) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Chain) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ChainId != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if m.ChainName != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.ChainName))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *BlockHeader) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *BlockHeader) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *BlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCommon(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
if m.ChainId != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x20
}
if len(m.ParentHash) > 0 {
i -= len(m.ParentHash)
copy(dAtA[i:], m.ParentHash)
i = encodeVarintCommon(dAtA, i, uint64(len(m.ParentHash)))
i--
dAtA[i] = 0x1a
}
if len(m.Hash) > 0 {
i -= len(m.Hash)
copy(dAtA[i:], m.Hash)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Hash)))
i--
dAtA[i] = 0x12
}
if m.Height != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *HeaderData) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *HeaderData) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *HeaderData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Data != nil {
{
size := m.Data.Size()
i -= size
if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
}
}
return len(dAtA) - i, nil
}
func (m *HeaderData_EthereumHeader) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *HeaderData_EthereumHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
if m.EthereumHeader != nil {
i -= len(m.EthereumHeader)
copy(dAtA[i:], m.EthereumHeader)
i = encodeVarintCommon(dAtA, i, uint64(len(m.EthereumHeader)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *HeaderData_BitcoinHeader) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *HeaderData_BitcoinHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
if m.BitcoinHeader != nil {
i -= len(m.BitcoinHeader)
copy(dAtA[i:], m.BitcoinHeader)
i = encodeVarintCommon(dAtA, i, uint64(len(m.BitcoinHeader)))
i--
dAtA[i] = 0x12
}
return len(dAtA) - i, nil
}
func (m *Proof) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Proof) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Proof != nil {
{
size := m.Proof.Size()
i -= size
if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
}
}
return len(dAtA) - i, nil
}
func (m *Proof_EthereumProof) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Proof_EthereumProof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
if m.EthereumProof != nil {
{
size, err := m.EthereumProof.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCommon(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Proof_BitcoinProof) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Proof_BitcoinProof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
if m.BitcoinProof != nil {
{
size, err := m.BitcoinProof.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCommon(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
return len(dAtA) - i, nil
}
func encodeVarintCommon(dAtA []byte, offset int, v uint64) int {
offset -= sovCommon(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *PubKeySet) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Secp256k1)
if l > 0 {
n += 1 + l + sovCommon(uint64(l))
}
l = len(m.Ed25519)
if l > 0 {
n += 1 + l + sovCommon(uint64(l))
}
return n
}
func (m *Chain) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainName != 0 {
n += 1 + sovCommon(uint64(m.ChainName))
}
if m.ChainId != 0 {
n += 1 + sovCommon(uint64(m.ChainId))
}
return n
}
func (m *BlockHeader) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovCommon(uint64(m.Height))
}
l = len(m.Hash)
if l > 0 {
n += 1 + l + sovCommon(uint64(l))
}
l = len(m.ParentHash)
if l > 0 {
n += 1 + l + sovCommon(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovCommon(uint64(m.ChainId))
}
l = m.Header.Size()
n += 1 + l + sovCommon(uint64(l))
return n
}
func (m *HeaderData) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Data != nil {
n += m.Data.Size()
}
return n
}
func (m *HeaderData_EthereumHeader) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.EthereumHeader != nil {
l = len(m.EthereumHeader)
n += 1 + l + sovCommon(uint64(l))
}
return n
}
func (m *HeaderData_BitcoinHeader) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BitcoinHeader != nil {
l = len(m.BitcoinHeader)
n += 1 + l + sovCommon(uint64(l))
}
return n
}
func (m *Proof) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Proof != nil {
n += m.Proof.Size()
}
return n
}
func (m *Proof_EthereumProof) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.EthereumProof != nil {
l = m.EthereumProof.Size()
n += 1 + l + sovCommon(uint64(l))
}
return n
}
func (m *Proof_BitcoinProof) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BitcoinProof != nil {
l = m.BitcoinProof.Size()
n += 1 + l + sovCommon(uint64(l))
}
return n
}
func sovCommon(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozCommon(x uint64) (n int) {
return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *PubKeySet) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: PubKeySet: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: PubKeySet: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Secp256k1", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Secp256k1 = PubKey(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Ed25519 = PubKey(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCommon(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCommon
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Chain) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Chain: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType)
}
m.ChainName = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainName |= ChainName(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipCommon(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCommon
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *BlockHeader) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: BlockHeader: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: BlockHeader: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...)
if m.Hash == nil {
m.Hash = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ParentHash = append(m.ParentHash[:0], dAtA[iNdEx:postIndex]...)
if m.ParentHash == nil {
m.ParentHash = []byte{}
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCommon(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCommon
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *HeaderData) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: HeaderData: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: HeaderData: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EthereumHeader", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
v := make([]byte, postIndex-iNdEx)
copy(v, dAtA[iNdEx:postIndex])
m.Data = &HeaderData_EthereumHeader{v}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BitcoinHeader", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
v := make([]byte, postIndex-iNdEx)
copy(v, dAtA[iNdEx:postIndex])
m.Data = &HeaderData_BitcoinHeader{v}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCommon(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCommon
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Proof) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Proof: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EthereumProof", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
v := ðereum.Proof{}
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
m.Proof = &Proof_EthereumProof{v}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BitcoinProof", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCommon
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
v := &bitcoin.Proof{}
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
m.Proof = &Proof_BitcoinProof{v}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCommon(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCommon
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipCommon(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCommon
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCommon
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCommon
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthCommon
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupCommon
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthCommon
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthCommon = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowCommon = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group")
)
//go:build TESTNET
// +build TESTNET
package common
func GoerliChain() Chain {
return Chain{
ChainName: ChainName_goerli_testnet,
ChainId: 5,
}
}
func BscTestnetChain() Chain {
return Chain{
ChainName: ChainName_bsc_testnet,
ChainId: 97,
}
}
func ZetaChain() Chain {
return Chain{
ChainName: ChainName_zeta_testnet,
ChainId: 7001,
}
}
func BtcTestNetChain() Chain {
return Chain{
ChainName: ChainName_btc_testnet,
ChainId: 18332,
}
}
func BtcChainID() int64 {
return BtcTestNetChain().ChainId
}
func BtcDustOffset() int64 {
return 2000
}
func MumbaiChain() Chain {
return Chain{
ChainName: ChainName_mumbai_testnet,
ChainId: 80001,
}
}
func DefaultChainsList() []*Chain {
chains := []Chain{
BtcTestNetChain(),
MumbaiChain(),
BscTestnetChain(),
GoerliChain(),
ZetaChain(),
}
var c []*Chain
for i := 0; i < len(chains); i++ {
c = append(c, &chains[i])
}
return c
}
func ExternalChainList() []*Chain {
chains := []Chain{
BtcTestNetChain(),
MumbaiChain(),
BscTestnetChain(),
GoerliChain(),
}
var c []*Chain
for i := 0; i < len(chains); i++ {
c = append(c, &chains[i])
}
return c
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: common/ethereum/ethereum.proto
package ethereum
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Proof struct {
Keys [][]byte `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
Values [][]byte `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"`
}
func (m *Proof) Reset() { *m = Proof{} }
func (m *Proof) String() string { return proto.CompactTextString(m) }
func (*Proof) ProtoMessage() {}
func (*Proof) Descriptor() ([]byte, []int) {
return fileDescriptor_93e74b59a4555c70, []int{0}
}
func (m *Proof) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Proof.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Proof) XXX_Merge(src proto.Message) {
xxx_messageInfo_Proof.Merge(m, src)
}
func (m *Proof) XXX_Size() int {
return m.Size()
}
func (m *Proof) XXX_DiscardUnknown() {
xxx_messageInfo_Proof.DiscardUnknown(m)
}
var xxx_messageInfo_Proof proto.InternalMessageInfo
func (m *Proof) GetKeys() [][]byte {
if m != nil {
return m.Keys
}
return nil
}
func (m *Proof) GetValues() [][]byte {
if m != nil {
return m.Values
}
return nil
}
func init() {
proto.RegisterType((*Proof)(nil), "ethereum.Proof")
}
func init() { proto.RegisterFile("common/ethereum/ethereum.proto", fileDescriptor_93e74b59a4555c70) }
var fileDescriptor_93e74b59a4555c70 = []byte{
// 159 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0xcf, 0xcd,
0xcd, 0xcf, 0xd3, 0x4f, 0x2d, 0xc9, 0x48, 0x2d, 0x4a, 0x2d, 0xcd, 0x85, 0x33, 0xf4, 0x0a, 0x8a,
0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, 0x7c, 0x25, 0x63, 0x2e, 0xd6, 0x80, 0xa2, 0xfc, 0xfc, 0x34,
0x21, 0x21, 0x2e, 0x96, 0xec, 0xd4, 0xca, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x9e, 0x20, 0x30,
0x5b, 0x48, 0x8c, 0x8b, 0xad, 0x2c, 0x31, 0xa7, 0x34, 0xb5, 0x58, 0x82, 0x09, 0x2c, 0x0a, 0xe5,
0x39, 0x79, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13,
0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5e, 0x7a, 0x66,
0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x55, 0x6a, 0x49, 0xa2, 0x6e, 0x72, 0x46,
0x62, 0x66, 0x1e, 0x98, 0x99, 0x9c, 0x5f, 0x94, 0xaa, 0x8f, 0xe6, 0xae, 0x24, 0x36, 0xb0, 0x7b,
0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x31, 0x9b, 0x72, 0x4f, 0xb1, 0x00, 0x00, 0x00,
}
func (m *Proof) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Proof) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Values) > 0 {
for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Values[iNdEx])
copy(dAtA[i:], m.Values[iNdEx])
i = encodeVarintEthereum(dAtA, i, uint64(len(m.Values[iNdEx])))
i--
dAtA[i] = 0x12
}
}
if len(m.Keys) > 0 {
for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Keys[iNdEx])
copy(dAtA[i:], m.Keys[iNdEx])
i = encodeVarintEthereum(dAtA, i, uint64(len(m.Keys[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintEthereum(dAtA []byte, offset int, v uint64) int {
offset -= sovEthereum(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Proof) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Keys) > 0 {
for _, b := range m.Keys {
l = len(b)
n += 1 + l + sovEthereum(uint64(l))
}
}
if len(m.Values) > 0 {
for _, b := range m.Values {
l = len(b)
n += 1 + l + sovEthereum(uint64(l))
}
}
return n
}
func sovEthereum(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozEthereum(x uint64) (n int) {
return sovEthereum(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Proof) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEthereum
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Proof: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEthereum
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthEthereum
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthEthereum
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx))
copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEthereum
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthEthereum
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthEthereum
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Values = append(m.Values, make([]byte, postIndex-iNdEx))
copy(m.Values[len(m.Values)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEthereum(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEthereum
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEthereum(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEthereum
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEthereum
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEthereum
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthEthereum
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEthereum
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthEthereum
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthEthereum = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEthereum = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEthereum = fmt.Errorf("proto: unexpected end of group")
)
// This file was adapted from go-ethereum. Here's the go-ethereum license reproduced:
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// Package trie implements Merkle Patricia Tries.
package ethereum
import (
"bytes"
"errors"
"sync"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
)
func NewProof() *Proof {
return &Proof{
Keys: make([][]byte, 0),
Values: make([][]byte, 0),
}
}
func (m *Proof) Put(key []byte, value []byte) error {
for i := 0; i < len(m.Keys); i++ {
if bytes.Equal(m.Keys[i], key) {
m.Values[i] = value
return nil
}
}
m.Keys = append(m.Keys, key)
m.Values = append(m.Values, value)
return nil
}
func (m *Proof) Delete(key []byte) error {
found := false
index := -1
for i := 0; i < len(m.Keys); i++ {
if bytes.Equal(m.Keys[i], key) {
found = true
index = i
break
}
}
if !found {
return errors.New("key not found")
}
copy(m.Keys[index:len(m.Keys)-1], m.Keys[index+1:])
copy(m.Values[index:len(m.Values)-1], m.Values[index+1:])
m.Keys = m.Keys[:len(m.Keys)-1]
m.Values = m.Values[:len(m.Values)-1]
return nil
}
func (m *Proof) Has(key []byte) (bool, error) {
for i := 0; i < len(m.Keys); i++ {
if bytes.Equal(m.Keys[i], key) {
return true, nil
}
}
return false, nil
}
func (m *Proof) Get(key []byte) ([]byte, error) {
found := false
index := -1
for i := 0; i < len(m.Keys); i++ {
if bytes.Equal(m.Keys[i], key) {
found = true
index = i
break
}
}
if !found {
return nil, errors.New("key not found")
}
return m.Values[index], nil
}
// Verify verifies the proof against the given root hash and key.
// Typically, the rootHash is from a trusted source (e.g. a trusted block header),
// and the key is the index of the transaction in the block.
func (m *Proof) Verify(rootHash common.Hash, key int) ([]byte, error) {
if key < 0 {
return nil, errors.New("key not found")
}
var indexBuf []byte
// #nosec G701 range is valid
indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(key))
return trie.VerifyProof(rootHash, indexBuf, m)
}
type Trie struct {
*trie.Trie
}
var encodeBufferPool = sync.Pool{
New: func() interface{} { return new(bytes.Buffer) },
}
func encodeForDerive(list types.DerivableList, i int, buf *bytes.Buffer) []byte {
buf.Reset()
list.EncodeIndex(i, buf)
// It's really unfortunate that we need to do perform this copy.
// StackTrie holds onto the values until Hash is called, so the values
// written to it must not alias.
return common.CopyBytes(buf.Bytes())
}
func (t *Trie) GenerateProof(txIndex int) (*Proof, error) {
if txIndex < 0 {
return nil, errors.New("transaction index out of range")
}
var indexBuf []byte
// #nosec G701 checked as non-negative
indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(txIndex))
proof := NewProof()
err := t.Prove(indexBuf, 0, proof)
if err != nil {
return nil, err
}
return proof, nil
}
// NewTrie builds a trie from a DerivableList. The DerivableList must be types.Transactions
// or types.Receipts.
func NewTrie(list types.DerivableList) Trie {
hasher := new(trie.Trie)
hasher.Reset()
valueBuf := encodeBufferPool.Get().(*bytes.Buffer)
defer encodeBufferPool.Put(valueBuf)
// StackTrie requires values to be inserted in increasing hash order, which is not the
// order that `list` provides hashes in. This insertion sequence ensures that the
// order is correct.
var indexBuf []byte
for i := 1; i < list.Len() && i <= 0x7f; i++ {
// #nosec G701 iterator
indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i))
value := encodeForDerive(list, i, valueBuf)
hasher.Update(indexBuf, value)
}
if list.Len() > 0 {
indexBuf = rlp.AppendUint64(indexBuf[:0], 0)
value := encodeForDerive(list, 0, valueBuf)
hasher.Update(indexBuf, value)
}
for i := 0x80; i < list.Len(); i++ {
// #nosec G701 iterator
indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i))
value := encodeForDerive(list, i, valueBuf)
hasher.Update(indexBuf, value)
}
return Trie{hasher}
}
package common
import (
"bytes"
"encoding/hex"
"errors"
"fmt"
"time"
"github.com/btcsuite/btcd/blockchain"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/zeta-chain/zetacore/common/bitcoin"
)
// NewEthereumHeader returns a new HeaderData containing an Ethereum header
func NewEthereumHeader(header []byte) HeaderData {
return HeaderData{
Data: &HeaderData_EthereumHeader{
EthereumHeader: header,
},
}
}
// NewBitcoinHeader returns a new HeaderData containing a Bitcoin header
func NewBitcoinHeader(header []byte) HeaderData {
return HeaderData{
Data: &HeaderData_BitcoinHeader{
BitcoinHeader: header,
},
}
}
// ParentHash extracts the parent hash from the header
func (h HeaderData) ParentHash() ([]byte, error) {
switch data := h.Data.(type) {
case *HeaderData_EthereumHeader:
var header ethtypes.Header
if err := rlp.DecodeBytes(data.EthereumHeader, &header); err != nil {
return nil, err
}
return header.ParentHash.Bytes(), nil
case *HeaderData_BitcoinHeader:
var header wire.BlockHeader
if err := header.Deserialize(bytes.NewReader(data.BitcoinHeader)); err != nil {
return nil, err
}
return header.PrevBlock[:], nil
default:
return nil, errors.New("unrecognized header type")
}
}
func (h HeaderData) ValidateTimestamp(zetaTime time.Time) error {
switch data := h.Data.(type) {
case *HeaderData_EthereumHeader:
// No timestamp validation for Ethereum for now
return nil
case *HeaderData_BitcoinHeader:
var header wire.BlockHeader
if err := header.Deserialize(bytes.NewReader(data.BitcoinHeader)); err != nil {
return err
}
// Below checks are borrowed from btcd/blockchain/validate.go because they are not exported
//
// A block timestamp must not have a greater precision than one second.
// This check is necessary because Go time.Time values support
// nanosecond precision whereas the consensus rules only apply to
// seconds and it's much nicer to deal with standard Go time values
// instead of converting to seconds everywhere.
if !header.Timestamp.Equal(time.Unix(header.Timestamp.Unix(), 0)) {
return fmt.Errorf("block timestamp of %v has a higher precision than one second", header.Timestamp)
}
// Ensure the block time is not too far in the future.
maxTimestamp := zetaTime.Add(time.Second * blockchain.MaxTimeOffsetSeconds)
if header.Timestamp.After(maxTimestamp) {
return fmt.Errorf("block timestamp of %v is too far in the future", header.Timestamp)
}
return nil
default:
return errors.New("cannot validate timestamp for unrecognized header type")
}
}
// Validate performs a basic validation of the HeaderData
func (h HeaderData) Validate(blockHash []byte, chainID int64, height int64) error {
switch data := h.Data.(type) {
case *HeaderData_EthereumHeader:
return validateEthereumHeader(data.EthereumHeader, blockHash, height)
case *HeaderData_BitcoinHeader:
return ValidateBitcoinHeader(data.BitcoinHeader, blockHash, chainID)
default:
return errors.New("unrecognized header type")
}
}
// validateEthereumHeader performs a basic validation of the Ethereum header
func validateEthereumHeader(headerBytes []byte, blockHash []byte, height int64) error {
// on ethereum the block header is ~538 bytes in RLP encoding
if len(headerBytes) > 1024 {
return fmt.Errorf("header too long (%d)", len(headerBytes))
}
// RLP encoded block header
var header ethtypes.Header
if err := rlp.DecodeBytes(headerBytes, &header); err != nil {
return fmt.Errorf("cannot decode RLP (%s)", err)
}
if err := header.SanityCheck(); err != nil {
return fmt.Errorf("sanity check failed (%s)", err)
}
if !bytes.Equal(blockHash, header.Hash().Bytes()) {
return fmt.Errorf("block hash mismatch (%s) vs (%s)", hex.EncodeToString(blockHash), header.Hash().Hex())
}
if height != header.Number.Int64() {
return fmt.Errorf("height mismatch (%d) vs (%d)", height, header.Number.Int64())
}
return nil
}
func ValidateBitcoinHeader(headerBytes []byte, blockHash []byte, chainID int64) error {
// Deserialize the 80-byte block header
if len(headerBytes) != bitcoin.BitcoinBlockHeaderLen {
return fmt.Errorf("header length mismatch (%d)", len(headerBytes))
}
var header wire.BlockHeader
if err := header.Deserialize(bytes.NewReader(headerBytes)); err != nil {
return fmt.Errorf("cannot deserialize Bitcoin header (%s)", err)
}
// Ensure the block hash matches the header
digest, err := chainhash.NewHash(blockHash)
if err != nil {
return fmt.Errorf("block hash conversion failed (%s)", err)
}
headerDigest := header.BlockHash()
if !bytes.Equal(digest[:], headerDigest[:]) {
return fmt.Errorf("block hash mismatch (%s) vs (%s)", digest, headerDigest)
}
// There is no strict rules on block version
if header.Version <= 0 {
return fmt.Errorf("invalid version (%d)", header.Version)
}
// Timestamp must be not earlier than genesis block
chainParams, err := GetBTCChainParams(chainID)
if err != nil {
return fmt.Errorf("cannot get chain params (%s) for chain id (%d)", err, chainID)
}
if chainParams.GenesisBlock.Header.Timestamp.After(header.Timestamp) {
return fmt.Errorf("block timestamp %v is before genesis block", header.Timestamp)
}
// Verify the proof-of-work
liteBlock := btcutil.NewBlock(&wire.MsgBlock{Header: header})
err = blockchain.CheckProofOfWork(liteBlock, chainParams.PowLimit)
if err != nil {
return fmt.Errorf("proof-of-work verification failed (%s)", err)
}
return nil
}
package common
import (
"bytes"
"errors"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
bitcoin "github.com/zeta-chain/zetacore/common/bitcoin"
"github.com/zeta-chain/zetacore/common/ethereum"
)
// ErrInvalidProof is a error type for invalid proofs embedding the underlying error
type ErrInvalidProof struct {
Err error
}
func NewErrInvalidProof(err error) ErrInvalidProof {
return ErrInvalidProof{
Err: err,
}
}
func (e ErrInvalidProof) Error() string {
return e.Err.Error()
}
// IsErrorInvalidProof returns true if the error is an ErrInvalidProof
func IsErrorInvalidProof(err error) bool {
return errors.As(err, &ErrInvalidProof{})
}
// NewEthereumProof returns a new Proof containing an Ethereum proof
func NewEthereumProof(proof *ethereum.Proof) *Proof {
return &Proof{
Proof: &Proof_EthereumProof{
EthereumProof: proof,
},
}
}
// NewBitcoinProof returns a new Proof containing a Bitcoin proof
func NewBitcoinProof(txBytes []byte, path []byte, index uint) *Proof {
return &Proof{
Proof: &Proof_BitcoinProof{
BitcoinProof: &bitcoin.Proof{
TxBytes: txBytes,
Path: path,
// #nosec G701 always in range
Index: uint32(index),
},
},
}
}
// Verify verifies the proof against the header
// Returns the verified tx in bytes if the verification is successful
func (p Proof) Verify(headerData HeaderData, txIndex int) ([]byte, error) {
switch proof := p.Proof.(type) {
case *Proof_EthereumProof:
ethHeaderBytes := headerData.GetEthereumHeader()
if ethHeaderBytes == nil {
return nil, errors.New("can't verify ethereum proof against non-ethereum header")
}
var ethHeader ethtypes.Header
err := rlp.DecodeBytes(ethHeaderBytes, ðHeader)
if err != nil {
return nil, err
}
val, err := proof.EthereumProof.Verify(ethHeader.TxHash, txIndex)
if err != nil {
return nil, NewErrInvalidProof(err)
}
return val, nil
case *Proof_BitcoinProof:
btcHeaderBytes := headerData.GetBitcoinHeader()
if len(btcHeaderBytes) != bitcoin.BitcoinBlockHeaderLen {
return nil, errors.New("can't verify bitcoin proof against non-bitcoin header")
}
var btcHeader wire.BlockHeader
if err := btcHeader.Deserialize(bytes.NewReader(btcHeaderBytes)); err != nil {
return nil, err
}
tx, err := btcutil.NewTxFromBytes(proof.BitcoinProof.TxBytes)
if err != nil {
return nil, err
}
pass := bitcoin.Prove(*tx.Hash(), btcHeader.MerkleRoot, proof.BitcoinProof.Path, uint(proof.BitcoinProof.Index))
if !pass {
return nil, NewErrInvalidProof(errors.New("invalid bitcoin proof"))
}
return proof.BitcoinProof.TxBytes, nil
default:
return nil, errors.New("unrecognized proof type")
}
}
package common
import (
"encoding/json"
"errors"
"fmt"
"sort"
"strings"
secp256k1 "github.com/btcsuite/btcd/btcec/v2"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/btcsuite/btcutil/bech32"
"github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
eth "github.com/ethereum/go-ethereum/crypto"
"github.com/tendermint/tendermint/crypto"
"github.com/zeta-chain/zetacore/common/cosmos"
)
// PubKey is bech32 encoded string
type (
PubKey string
PubKeys []PubKey
)
var EmptyPubKey PubKey
// EmptyPubKeySet
//var EmptyPubKeySet PubKeySet
// NewPubKey create a new instance of PubKey
// key is bech32 encoded string
func GetAddressFromPubkeyString(pubkey string) (sdk.AccAddress, error) {
cryptopub, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, pubkey)
if err != nil {
return nil, err
}
addr, err := sdk.AccAddressFromHexUnsafe(cryptopub.Address().String())
if err != nil {
return nil, err
}
return addr, nil
}
func NewPubKey(key string) (PubKey, error) {
if len(key) == 0 {
return EmptyPubKey, nil
}
_, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, key)
if err != nil {
return EmptyPubKey, fmt.Errorf("%s is not bech32 encoded pub key,err : %w", key, err)
}
return PubKey(key), nil
}
// NewPubKeyFromCrypto
func NewPubKeyFromCrypto(pk crypto.PubKey) (PubKey, error) {
tmp, err := codec.FromTmPubKeyInterface(pk)
if err != nil {
return EmptyPubKey, fmt.Errorf("fail to create PubKey from crypto.PubKey,err:%w", err)
}
s, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, tmp)
if err != nil {
return EmptyPubKey, fmt.Errorf("fail to create PubKey from crypto.PubKey,err:%w", err)
}
return PubKey(s), nil
}
// Equals check whether two are the same
func (pubKey PubKey) Equals(pubKey1 PubKey) bool {
return pubKey == pubKey1
}
// IsEmpty to check whether it is empty
func (pubKey PubKey) IsEmpty() bool {
return len(pubKey) == 0
}
// String stringer implementation
func (pubKey PubKey) String() string {
return string(pubKey)
}
// GetAddress will return an address for the given chain
func (pubKey PubKey) GetAddress(chain Chain) (Address, error) {
if pubKey.IsEmpty() {
return NoAddress, nil
}
if IsEVMChain(chain.ChainId) {
// retrieve compressed pubkey bytes from bechh32 encoded str
pk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, string(pubKey))
if err != nil {
return NoAddress, err
}
// parse compressed bytes removing 5 first bytes (amino encoding) to get uncompressed
pub, err := secp256k1.ParsePubKey(pk.Bytes())
if err != nil {
return NoAddress, err
}
str := strings.ToLower(eth.PubkeyToAddress(*pub.ToECDSA()).String())
return NewAddress(str, chain)
}
return NoAddress, nil
}
func (pubKey PubKey) GetZetaAddress() (cosmos.AccAddress, error) {
addr, err := pubKey.GetAddress(ZetaChain())
if err != nil {
return nil, err
}
return cosmos.AccAddressFromBech32(addr.String())
}
// MarshalJSON to Marshals to JSON using Bech32
func (pubKey PubKey) MarshalJSON() ([]byte, error) {
return json.Marshal(pubKey.String())
}
// UnmarshalJSON to Unmarshal from JSON assuming Bech32 encoding
func (pubKey *PubKey) UnmarshalJSON(data []byte) error {
var s string
err := json.Unmarshal(data, &s)
if err != nil {
return err
}
pk, err := NewPubKey(s)
if err != nil {
return err
}
*pubKey = pk
return nil
}
func (pks PubKeys) Valid() error {
for _, pk := range pks {
if _, err := NewPubKey(pk.String()); err != nil {
return err
}
}
return nil
}
func (pks PubKeys) Contains(pk PubKey) bool {
for _, p := range pks {
if p.Equals(pk) {
return true
}
}
return false
}
// Equals check whether two pub keys are identical
func (pks PubKeys) Equals(newPks PubKeys) bool {
if len(pks) != len(newPks) {
return false
}
source := append(pks[:0:0], pks...)
dest := append(newPks[:0:0], newPks...)
// sort both lists
sort.Slice(source[:], func(i, j int) bool {
return source[i].String() < source[j].String()
})
sort.Slice(dest[:], func(i, j int) bool {
return dest[i].String() < dest[j].String()
})
for i := range source {
if !source[i].Equals(dest[i]) {
return false
}
}
return true
}
// String implement stringer interface
func (pks PubKeys) String() string {
strs := make([]string, len(pks))
for i := range pks {
strs[i] = pks[i].String()
}
return strings.Join(strs, ", ")
}
func (pks PubKeys) Strings() []string {
allStrings := make([]string, len(pks))
for i, pk := range pks {
allStrings[i] = pk.String()
}
return allStrings
}
// ConvertAndEncode converts from a base64 encoded byte string to hex or base32 encoded byte string and then to bech32
func ConvertAndEncode(hrp string, data []byte) (string, error) {
converted, err := bech32.ConvertBits(data, 8, 5, true)
if err != nil {
return "", fmt.Errorf("encoding bech32 failed,%w", err)
}
return bech32.Encode(hrp, converted)
}
// NewPubKeySet create a new instance of PubKeySet , which contains two keys
func NewPubKeySet(secp256k1, ed25519 PubKey) PubKeySet {
return PubKeySet{
Secp256k1: secp256k1,
Ed25519: ed25519,
}
}
func GetPubkeyBech32FromRecord(record *keyring.Record) (string, error) {
pk, ok := record.PubKey.GetCachedValue().(cryptotypes.PubKey)
if !ok {
return "", errors.New("unable to cast any to cryptotypes.PubKey")
}
s, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, pk)
if err != nil {
return "", err
}
return s, nil
}
package common
import (
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/chaincfg/chainhash"
ethcommon "github.com/ethereum/go-ethereum/common"
)
// A very special value to mark current nonce in UTXO
func NonceMarkAmount(nonce uint64) int64 {
// #nosec G701 always in range
return int64(nonce) + BtcDustOffset() // +2000 to avoid being a dust rejection
}
// HashToString convert hash bytes to string
func HashToString(chainID int64, blockHash []byte) (string, error) {
if IsEVMChain(chainID) {
return hex.EncodeToString(blockHash), nil
} else if IsBitcoinChain(chainID) {
hash, err := chainhash.NewHash(blockHash)
if err != nil {
return "", err
}
return hash.String(), nil
}
return "", fmt.Errorf("cannot convert hash to string for chain %d", chainID)
}
// StringToHash convert string to hash bytes
func StringToHash(chainID int64, hash string) ([]byte, error) {
if IsEVMChain(chainID) {
return ethcommon.HexToHash(hash).Bytes(), nil
} else if IsBitcoinChain(chainID) {
hash, err := chainhash.NewHashFromStr(hash)
if err != nil {
return nil, err
}
return hash.CloneBytes(), nil
}
return nil, fmt.Errorf("cannot convert hash to bytes for chain %d", chainID)
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package pubsub
import (
"sync"
"sync/atomic"
"github.com/pkg/errors"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
)
type UnsubscribeFunc func()
type EventBus interface {
AddTopic(name string, src <-chan coretypes.ResultEvent) error
RemoveTopic(name string)
Subscribe(name string) (<-chan coretypes.ResultEvent, UnsubscribeFunc, error)
Topics() []string
}
type memEventBus struct {
topics map[string]<-chan coretypes.ResultEvent
topicsMux *sync.RWMutex
subscribers map[string]map[uint64]chan<- coretypes.ResultEvent
subscribersMux *sync.RWMutex
currentUniqueID uint64
}
func NewEventBus() EventBus {
return &memEventBus{
topics: make(map[string]<-chan coretypes.ResultEvent),
topicsMux: new(sync.RWMutex),
subscribers: make(map[string]map[uint64]chan<- coretypes.ResultEvent),
subscribersMux: new(sync.RWMutex),
}
}
func (m *memEventBus) GenUniqueID() uint64 {
return atomic.AddUint64(&m.currentUniqueID, 1)
}
func (m *memEventBus) Topics() (topics []string) {
m.topicsMux.RLock()
defer m.topicsMux.RUnlock()
topics = make([]string, 0, len(m.topics))
for topicName := range m.topics {
topics = append(topics, topicName)
}
return topics
}
func (m *memEventBus) AddTopic(name string, src <-chan coretypes.ResultEvent) error {
m.topicsMux.RLock()
_, ok := m.topics[name]
m.topicsMux.RUnlock()
if ok {
return errors.New("topic already registered")
}
m.topicsMux.Lock()
m.topics[name] = src
m.topicsMux.Unlock()
go m.publishTopic(name, src)
return nil
}
func (m *memEventBus) RemoveTopic(name string) {
m.topicsMux.Lock()
delete(m.topics, name)
m.topicsMux.Unlock()
}
func (m *memEventBus) Subscribe(name string) (<-chan coretypes.ResultEvent, UnsubscribeFunc, error) {
m.topicsMux.RLock()
_, ok := m.topics[name]
m.topicsMux.RUnlock()
if !ok {
return nil, nil, errors.Errorf("topic not found: %s", name)
}
ch := make(chan coretypes.ResultEvent)
m.subscribersMux.Lock()
defer m.subscribersMux.Unlock()
id := m.GenUniqueID()
if _, ok := m.subscribers[name]; !ok {
m.subscribers[name] = make(map[uint64]chan<- coretypes.ResultEvent)
}
m.subscribers[name][id] = ch
unsubscribe := func() {
m.subscribersMux.Lock()
defer m.subscribersMux.Unlock()
delete(m.subscribers[name], id)
}
return ch, unsubscribe, nil
}
func (m *memEventBus) publishTopic(name string, src <-chan coretypes.ResultEvent) {
for {
msg, ok := <-src
if !ok {
m.closeAllSubscribers(name)
m.topicsMux.Lock()
delete(m.topics, name)
m.topicsMux.Unlock()
return
}
m.publishAllSubscribers(name, msg)
}
}
func (m *memEventBus) closeAllSubscribers(name string) {
m.subscribersMux.Lock()
defer m.subscribersMux.Unlock()
subsribers := m.subscribers[name]
delete(m.subscribers, name)
for _, sub := range subsribers {
close(sub)
}
}
func (m *memEventBus) publishAllSubscribers(name string, msg coretypes.ResultEvent) {
m.subscribersMux.RLock()
subsribers := m.subscribers[name]
m.subscribersMux.RUnlock()
for _, sub := range subsribers {
select {
case sub <- msg:
default:
}
}
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package types
import (
"sync"
"github.com/ethereum/go-ethereum/common"
)
// AddrLocker is a mutex structure used to avoid querying outdated account data
type AddrLocker struct {
mu sync.Mutex
locks map[common.Address]*sync.Mutex
}
// lock returns the lock of the given address.
func (l *AddrLocker) lock(address common.Address) *sync.Mutex {
l.mu.Lock()
defer l.mu.Unlock()
if l.locks == nil {
l.locks = make(map[common.Address]*sync.Mutex)
}
if _, ok := l.locks[address]; !ok {
l.locks[address] = new(sync.Mutex)
}
return l.locks[address]
}
// LockAddr locks an account's mutex. This is used to prevent another tx getting the
// same nonce until the lock is released. The mutex prevents the (an identical nonce) from
// being read again during the time that the first transaction is being signed.
func (l *AddrLocker) LockAddr(address common.Address) {
l.lock(address).Lock()
}
// UnlockAddr unlocks the mutex of the given account.
func (l *AddrLocker) UnlockAddr(address common.Address) {
l.lock(address).Unlock()
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package types
import (
"context"
"encoding/json"
"errors"
"fmt"
"math"
"math/big"
"strings"
"github.com/spf13/cast"
"google.golang.org/grpc/metadata"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
ethermint "github.com/evmos/ethermint/types"
)
// BlockNumber represents decoding hex string to block values
type BlockNumber int64
const (
EthPendingBlockNumber = BlockNumber(-2)
EthLatestBlockNumber = BlockNumber(-1)
EthEarliestBlockNumber = BlockNumber(0)
)
const (
BlockParamEarliest = "earliest"
BlockParamLatest = "latest"
BlockParamFinalized = "finalized"
BlockParamSafe = "safe"
BlockParamPending = "pending"
)
// NewBlockNumber creates a new BlockNumber instance.
func NewBlockNumber(n *big.Int) BlockNumber {
if !n.IsInt64() {
// default to latest block if it overflows
return EthLatestBlockNumber
}
return BlockNumber(n.Int64())
}
// ContextWithHeight wraps a context with the a gRPC block height header. If the provided height is
// 0, it will return an empty context and the gRPC query will use the latest block height for querying.
// Note that all metadata are processed and removed by tendermint layer, so it wont be accessible at gRPC server level.
func ContextWithHeight(height int64) context.Context {
if height == 0 {
return context.Background()
}
return metadata.AppendToOutgoingContext(context.Background(), grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height))
}
// UnmarshalJSON parses the given JSON fragment into a BlockNumber. It supports:
// - "latest", "finalized", "earliest" or "pending" as string arguments
// - the block number
// Returned errors:
// - an invalid block number error when the given argument isn't a known strings
// - an out of range error when the given block number is either too little or too large
func (bn *BlockNumber) UnmarshalJSON(data []byte) error {
input := strings.TrimSpace(string(data))
if len(input) >= 2 && input[0] == '"' && input[len(input)-1] == '"' {
input = input[1 : len(input)-1]
}
switch input {
case BlockParamEarliest:
*bn = EthEarliestBlockNumber
return nil
case BlockParamLatest, BlockParamFinalized, BlockParamSafe:
*bn = EthLatestBlockNumber
return nil
case BlockParamPending:
*bn = EthPendingBlockNumber
return nil
}
blckNum, err := hexutil.DecodeUint64(input)
if errors.Is(err, hexutil.ErrMissingPrefix) {
blckNum = cast.ToUint64(input)
} else if err != nil {
return err
}
if blckNum > math.MaxInt64 {
return fmt.Errorf("block number larger than int64")
}
// #nosec G701 range checked
*bn = BlockNumber(blckNum)
return nil
}
// Int64 converts block number to primitive type
func (bn BlockNumber) Int64() int64 {
if bn < 0 {
return 0
} else if bn == 0 {
return 1
}
return int64(bn)
}
// TmHeight is a util function used for the Tendermint RPC client. It returns
// nil if the block number is "latest". Otherwise, it returns the pointer of the
// int64 value of the height.
func (bn BlockNumber) TmHeight() *int64 {
if bn < 0 {
return nil
}
height := bn.Int64()
return &height
}
// BlockNumberOrHash represents a block number or a block hash.
type BlockNumberOrHash struct {
BlockNumber *BlockNumber `json:"blockNumber,omitempty"`
BlockHash *common.Hash `json:"blockHash,omitempty"`
}
func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error {
type erased BlockNumberOrHash
e := erased{}
err := json.Unmarshal(data, &e)
if err == nil {
return bnh.checkUnmarshal(BlockNumberOrHash(e))
}
var input string
err = json.Unmarshal(data, &input)
if err != nil {
return err
}
err = bnh.decodeFromString(input)
if err != nil {
return err
}
return nil
}
func (bnh *BlockNumberOrHash) checkUnmarshal(e BlockNumberOrHash) error {
if e.BlockNumber != nil && e.BlockHash != nil {
return fmt.Errorf("cannot specify both BlockHash and BlockNumber, choose one or the other")
}
bnh.BlockNumber = e.BlockNumber
bnh.BlockHash = e.BlockHash
return nil
}
func (bnh *BlockNumberOrHash) decodeFromString(input string) error {
switch input {
case BlockParamEarliest:
bn := EthEarliestBlockNumber
bnh.BlockNumber = &bn
case BlockParamLatest, BlockParamFinalized:
bn := EthLatestBlockNumber
bnh.BlockNumber = &bn
case BlockParamPending:
bn := EthPendingBlockNumber
bnh.BlockNumber = &bn
default:
// check if the input is a block hash
if len(input) == 66 {
hash := common.Hash{}
err := hash.UnmarshalText([]byte(input))
if err != nil {
return err
}
bnh.BlockHash = &hash
break
}
// otherwise take the hex string has int64 value
blockNumber, err := hexutil.DecodeUint64(input)
if err != nil {
return err
}
bnInt, err := ethermint.SafeInt64(blockNumber)
if err != nil {
return err
}
bn := BlockNumber(bnInt)
bnh.BlockNumber = &bn
}
return nil
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package types
import (
"fmt"
"math/big"
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
abci "github.com/tendermint/tendermint/abci/types"
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
)
// EventFormat is the format version of the events.
//
// To fix the issue of tx exceeds block gas limit, we changed the event format in a breaking way.
// But to avoid forcing clients to re-sync from scatch, we make json-rpc logic to be compatible with both formats.
type EventFormat int
const (
MessageType = "message"
AmountType = "amount"
SenderType = "sender"
CosmosEVMTxType = 88
eventFormatUnknown EventFormat = iota
// Event Format 1 (the format used before PR #1062):
// ```
// ethereum_tx(amount, ethereumTxHash, [txIndex, txGasUsed], txHash, [receipient], ethereumTxFailed)
// tx_log(txLog, txLog, ...)
// ethereum_tx(amount, ethereumTxHash, [txIndex, txGasUsed], txHash, [receipient], ethereumTxFailed)
// tx_log(txLog, txLog, ...)
// ...
// ```
eventFormat1
// Event Format 2 (the format used after PR #1062):
// ```
// ethereum_tx(ethereumTxHash, txIndex)
// ethereum_tx(ethereumTxHash, txIndex)
// ...
// ethereum_tx(amount, ethereumTxHash, txIndex, txGasUsed, txHash, [receipient], ethereumTxFailed)
// tx_log(txLog, txLog, ...)
// ethereum_tx(amount, ethereumTxHash, txIndex, txGasUsed, txHash, [receipient], ethereumTxFailed)
// tx_log(txLog, txLog, ...)
// ...
// ```
// If the transaction exceeds block gas limit, it only emits the first part.
eventFormat2
)
// ParsedTx is the tx infos parsed from events.
type ParsedTx struct {
MsgIndex int
// the following fields are parsed from events
Hash common.Hash
// -1 means uninitialized
EthTxIndex int32
GasUsed uint64
Failed bool
// Additional cosmos EVM tx fields
TxHash string
Type uint64
Amount *big.Int
Recipient common.Address
Sender common.Address
}
// NewParsedTx initialize a ParsedTx
func NewParsedTx(msgIndex int) ParsedTx {
return ParsedTx{MsgIndex: msgIndex, EthTxIndex: -1}
}
// ParsedTxs is the tx infos parsed from eth tx events.
type ParsedTxs struct {
// one item per message
Txs []ParsedTx
// map tx hash to msg index
TxHashes map[common.Hash]int
}
// ParseTxResult parse eth tx infos from cosmos-sdk events.
// It supports two event formats, the formats are described in the comments of the format constants.
func ParseTxResult(result *abci.ResponseDeliverTx, tx sdk.Tx) (*ParsedTxs, error) {
format := eventFormatUnknown
// the index of current ethereum_tx event in format 1 or the second part of format 2
eventIndex := -1
p := &ParsedTxs{
TxHashes: make(map[common.Hash]int),
}
prevEventType := ""
for _, event := range result.Events {
if event.Type != evmtypes.EventTypeEthereumTx && (prevEventType != evmtypes.EventTypeEthereumTx || event.Type != MessageType) {
continue
}
// Parse tendermint message after ethereum_tx event
if prevEventType == evmtypes.EventTypeEthereumTx && event.Type == MessageType && eventIndex != -1 {
err := fillTxAttributes(&p.Txs[eventIndex], event.Attributes)
if err != nil {
return nil, err
}
}
if event.Type == MessageType {
prevEventType = MessageType
continue
}
if format == eventFormatUnknown {
// discover the format version by inspect the first ethereum_tx event.
if len(event.Attributes) > 2 {
format = eventFormat1
} else {
format = eventFormat2
}
}
if len(event.Attributes) == 2 {
// the first part of format 2
if err := p.newTx(event.Attributes); err != nil {
return nil, err
}
} else {
// format 1 or second part of format 2
eventIndex++
if format == eventFormat1 {
// append tx
if err := p.newTx(event.Attributes); err != nil {
return nil, err
}
} else {
// the second part of format 2, update tx fields
if err := p.updateTx(eventIndex, event.Attributes); err != nil {
return nil, err
}
}
}
prevEventType = evmtypes.EventTypeEthereumTx
}
// some old versions miss some events, fill it with tx result
if len(p.Txs) == 1 {
// #nosec G701 always positive
p.Txs[0].GasUsed = uint64(result.GasUsed)
}
// this could only happen if tx exceeds block gas limit
if result.Code != 0 && tx != nil {
for i := 0; i < len(p.Txs); i++ {
p.Txs[i].Failed = true
// replace gasUsed with gasLimit because that's what's actually deducted.
gasLimit := tx.GetMsgs()[i].(*evmtypes.MsgEthereumTx).GetGas()
p.Txs[i].GasUsed = gasLimit
}
}
return p, nil
}
// ParseTxIndexerResult parse tm tx result to a format compatible with the custom tx indexer.
func ParseTxIndexerResult(txResult *tmrpctypes.ResultTx, tx sdk.Tx, getter func(*ParsedTxs) *ParsedTx) (*ethermint.TxResult, *TxResultAdditionalFields, error) {
txs, err := ParseTxResult(&txResult.TxResult, tx)
if err != nil {
return nil, nil, fmt.Errorf("failed to parse tx events: block %d, index %d, %v", txResult.Height, txResult.Index, err)
}
parsedTx := getter(txs)
if parsedTx == nil {
return nil, nil, fmt.Errorf("ethereum tx not found in msgs: block %d, index %d", txResult.Height, txResult.Index)
}
if parsedTx.Type == 88 {
return ðermint.TxResult{
Height: txResult.Height,
TxIndex: txResult.Index,
// #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
GasUsed: parsedTx.GasUsed,
CumulativeGasUsed: txs.AccumulativeGasUsed(parsedTx.MsgIndex),
}, &TxResultAdditionalFields{
Value: parsedTx.Amount,
Hash: parsedTx.Hash,
TxHash: parsedTx.TxHash,
Type: parsedTx.Type,
Recipient: parsedTx.Recipient,
Sender: parsedTx.Sender,
}, nil
}
return ðermint.TxResult{
Height: txResult.Height,
TxIndex: txResult.Index,
// #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
GasUsed: parsedTx.GasUsed,
CumulativeGasUsed: txs.AccumulativeGasUsed(parsedTx.MsgIndex),
}, nil, nil
}
// ParseTxIndexerResult parse tm tx result to a format compatible with the custom tx indexer.
func ParseTxBlockResult(txResult *abci.ResponseDeliverTx, tx sdk.Tx, txIndex int, height int64) (*ethermint.TxResult, *TxResultAdditionalFields, error) {
txs, err := ParseTxResult(txResult, tx)
if err != nil {
return nil, nil, fmt.Errorf("failed to parse tx events: block %d, index %d, %v", height, txIndex, err)
}
if len(txs.Txs) == 0 {
return nil, nil, fmt.Errorf("ethereum tx not found in msgs: block %d, index %d", height, txIndex)
}
parsedTx := txs.Txs[0]
if parsedTx.Type == 88 {
return ðermint.TxResult{
Height: height,
// #nosec G701 always in range
TxIndex: uint32(txIndex),
// #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
GasUsed: parsedTx.GasUsed,
CumulativeGasUsed: txs.AccumulativeGasUsed(parsedTx.MsgIndex),
}, &TxResultAdditionalFields{
Value: parsedTx.Amount,
Hash: parsedTx.Hash,
TxHash: parsedTx.TxHash,
Type: parsedTx.Type,
Recipient: parsedTx.Recipient,
Sender: parsedTx.Sender,
GasUsed: parsedTx.GasUsed,
}, nil
}
return ðermint.TxResult{
Height: height,
// #nosec G701 always in range
TxIndex: uint32(txIndex),
// #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
GasUsed: parsedTx.GasUsed,
CumulativeGasUsed: txs.AccumulativeGasUsed(parsedTx.MsgIndex),
}, nil, nil
}
// newTx parse a new tx from events, called during parsing.
func (p *ParsedTxs) newTx(attrs []abci.EventAttribute) error {
msgIndex := len(p.Txs)
tx := NewParsedTx(msgIndex)
if err := fillTxAttributes(&tx, attrs); err != nil {
return err
}
p.Txs = append(p.Txs, tx)
p.TxHashes[tx.Hash] = msgIndex
return nil
}
// updateTx updates an exiting tx from events, called during parsing.
// In event format 2, we update the tx with the attributes of the second `ethereum_tx` event,
// Due to bug https://github.com/evmos/ethermint/issues/1175, the first `ethereum_tx` event may emit incorrect tx hash,
// so we prefer the second event and override the first one.
func (p *ParsedTxs) updateTx(eventIndex int, attrs []abci.EventAttribute) error {
tx := NewParsedTx(eventIndex)
if err := fillTxAttributes(&tx, attrs); err != nil {
return err
}
if tx.Hash != p.Txs[eventIndex].Hash {
// if hash is different, index the new one too
p.TxHashes[tx.Hash] = eventIndex
}
// override the tx because the second event is more trustworthy
p.Txs[eventIndex] = tx
return nil
}
// GetTxByHash find ParsedTx by tx hash, returns nil if not exists.
func (p *ParsedTxs) GetTxByHash(hash common.Hash) *ParsedTx {
if idx, ok := p.TxHashes[hash]; ok {
return &p.Txs[idx]
}
return nil
}
// GetTxByMsgIndex returns ParsedTx by msg index
func (p *ParsedTxs) GetTxByMsgIndex(i int) *ParsedTx {
if i < 0 || i >= len(p.Txs) {
return nil
}
return &p.Txs[i]
}
// GetTxByTxIndex returns ParsedTx by tx index
func (p *ParsedTxs) GetTxByTxIndex(txIndex int) *ParsedTx {
if len(p.Txs) == 0 {
return nil
}
// assuming the `EthTxIndex` increase continuously,
// convert TxIndex to MsgIndex by subtract the begin TxIndex.
msgIndex := txIndex - int(p.Txs[0].EthTxIndex)
// GetTxByMsgIndex will check the bound
return p.GetTxByMsgIndex(msgIndex)
}
// AccumulativeGasUsed calculates the accumulated gas used within the batch of txs
func (p *ParsedTxs) AccumulativeGasUsed(msgIndex int) (result uint64) {
for i := 0; i <= msgIndex; i++ {
result += p.Txs[i].GasUsed
}
return result
}
// fillTxAttribute parse attributes by name, less efficient than hardcode the index, but more stable against event
// format changes.
func fillTxAttribute(tx *ParsedTx, key []byte, value []byte) error {
switch string(key) {
case evmtypes.AttributeKeyEthereumTxHash:
tx.Hash = common.HexToHash(string(value))
case evmtypes.AttributeKeyTxIndex:
txIndex, err := strconv.ParseUint(string(value), 10, 31)
if err != nil {
return err
}
// #nosec G701 always in range
tx.EthTxIndex = int32(txIndex)
case evmtypes.AttributeKeyTxGasUsed:
gasUsed, err := strconv.ParseUint(string(value), 10, 64)
if err != nil {
return err
}
tx.GasUsed = gasUsed
case evmtypes.AttributeKeyEthereumTxFailed:
tx.Failed = len(value) > 0
case SenderType:
tx.Sender = common.HexToAddress(string(value))
case evmtypes.AttributeKeyRecipient:
tx.Recipient = common.HexToAddress(string(value))
case evmtypes.AttributeKeyTxHash:
tx.TxHash = string(value)
case evmtypes.AttributeKeyTxType:
txType, err := strconv.ParseUint(string(value), 10, 31)
if err != nil {
return err
}
tx.Type = txType
case AmountType:
var success bool
tx.Amount, success = big.NewInt(0).SetString(string(value), 10)
if !success {
return nil
}
}
return nil
}
func fillTxAttributes(tx *ParsedTx, attrs []abci.EventAttribute) error {
for _, attr := range attrs {
if err := fillTxAttribute(tx, attr.Key, attr.Value); err != nil {
return err
}
}
return nil
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package types
import (
"fmt"
"github.com/cosmos/cosmos-sdk/types/tx"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/proto/tendermint/crypto"
"github.com/cosmos/cosmos-sdk/client"
evmtypes "github.com/evmos/ethermint/x/evm/types"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
)
// QueryClient defines a gRPC Client used for:
// - Transaction simulation
// - EVM module queries
// - Fee market module queries
type QueryClient struct {
tx.ServiceClient
evmtypes.QueryClient
FeeMarket feemarkettypes.QueryClient
}
// NewQueryClient creates a new gRPC query client
func NewQueryClient(clientCtx client.Context) *QueryClient {
return &QueryClient{
ServiceClient: tx.NewServiceClient(clientCtx),
QueryClient: evmtypes.NewQueryClient(clientCtx),
FeeMarket: feemarkettypes.NewQueryClient(clientCtx),
}
}
// GetProof performs an ABCI query with the given key and returns a merkle proof. The desired
// tendermint height to perform the query should be set in the client context. The query will be
// performed at one below this height (at the IAVL version) in order to obtain the correct merkle
// proof. Proof queries at height less than or equal to 2 are not supported.
// Issue: https://github.com/cosmos/cosmos-sdk/issues/6567
func (QueryClient) GetProof(clientCtx client.Context, storeKey string, key []byte) ([]byte, *crypto.ProofOps, error) {
height := clientCtx.Height
// ABCI queries at height less than or equal to 2 are not supported.
// Base app does not support queries for height less than or equal to 1.
// Therefore, a query at height 2 would be equivalent to a query at height 3
if height <= 2 {
return nil, nil, fmt.Errorf("proof queries at height <= 2 are not supported")
}
abciReq := abci.RequestQuery{
Path: fmt.Sprintf("store/%s/key", storeKey),
Data: key,
Height: height,
Prove: true,
}
abciRes, err := clientCtx.QueryABCI(abciReq)
if err != nil {
return nil, nil, err
}
return abciRes.Value, abciRes.ProofOps, nil
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package types
import (
"bytes"
"context"
"fmt"
"math/big"
"strings"
abci "github.com/tendermint/tendermint/abci/types"
tmtypes "github.com/tendermint/tendermint/types"
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/client"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
evmtypes "github.com/evmos/ethermint/x/evm/types"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/math"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
)
// ExceedBlockGasLimitError defines the error message when tx execution exceeds the block gas limit.
// The tx fee is deducted in ante handler, so it shouldn't be ignored in JSON-RPC API.
const ExceedBlockGasLimitError = "out of gas in location: block gas meter; gasWanted:"
// RawTxToEthTx returns a evm MsgEthereum transaction from raw tx bytes.
func RawTxToEthTx(clientCtx client.Context, txBz tmtypes.Tx) ([]*evmtypes.MsgEthereumTx, error) {
tx, err := clientCtx.TxConfig.TxDecoder()(txBz)
if err != nil {
return nil, errorsmod.Wrap(errortypes.ErrJSONUnmarshal, err.Error())
}
ethTxs := make([]*evmtypes.MsgEthereumTx, len(tx.GetMsgs()))
for i, msg := range tx.GetMsgs() {
ethTx, ok := msg.(*evmtypes.MsgEthereumTx)
if !ok {
return nil, fmt.Errorf("invalid message type %T, expected %T", msg, &evmtypes.MsgEthereumTx{})
}
ethTx.Hash = ethTx.AsTransaction().Hash().Hex()
ethTxs[i] = ethTx
}
return ethTxs, nil
}
// EthHeaderFromTendermint is an util function that returns an Ethereum Header
// from a tendermint Header.
func EthHeaderFromTendermint(header tmtypes.Header, bloom ethtypes.Bloom, baseFee *big.Int) *ethtypes.Header {
txHash := ethtypes.EmptyRootHash
if len(header.DataHash) == 0 {
txHash = common.BytesToHash(header.DataHash)
}
return ðtypes.Header{
ParentHash: common.BytesToHash(header.LastBlockID.Hash.Bytes()),
UncleHash: ethtypes.EmptyUncleHash,
Coinbase: common.BytesToAddress(header.ProposerAddress),
Root: common.BytesToHash(header.AppHash),
TxHash: txHash,
ReceiptHash: ethtypes.EmptyRootHash,
Bloom: bloom,
Difficulty: big.NewInt(0),
Number: big.NewInt(header.Height),
GasLimit: 0,
GasUsed: 0,
// #nosec G701 always positive
Time: uint64(header.Time.UTC().Unix()),
Extra: []byte{},
MixDigest: common.Hash{},
Nonce: ethtypes.BlockNonce{},
BaseFee: baseFee,
}
}
// BlockMaxGasFromConsensusParams returns the gas limit for the current block from the chain consensus params.
func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (int64, error) {
resConsParams, err := clientCtx.Client.ConsensusParams(goCtx, &blockHeight)
if err != nil {
// #nosec G701 always in range
return int64(^uint32(0)), err
}
gasLimit := resConsParams.ConsensusParams.Block.MaxGas
if gasLimit == -1 {
// Sets gas limit to max uint32 to not error with javascript dev tooling
// This -1 value indicating no block gas limit is set to max uint64 with geth hexutils
// which errors certain javascript dev tooling which only supports up to 53 bits
// #nosec G701 always in range
gasLimit = int64(^uint32(0))
}
return gasLimit, nil
}
// FormatBlock creates an ethereum block from a tendermint header and ethereum-formatted
// transactions.
func FormatBlock(
header tmtypes.Header, size int, gasLimit int64,
gasUsed *big.Int, transactions []interface{}, bloom ethtypes.Bloom,
validatorAddr common.Address, baseFee *big.Int,
) map[string]interface{} {
var transactionsRoot common.Hash
if len(transactions) == 0 {
transactionsRoot = ethtypes.EmptyRootHash
} else {
transactionsRoot = common.BytesToHash(header.DataHash)
}
result := map[string]interface{}{
"number": hexutil.Uint64(header.Height),
"hash": hexutil.Bytes(header.Hash()),
"parentHash": common.BytesToHash(header.LastBlockID.Hash.Bytes()),
"nonce": ethtypes.BlockNonce{}, // PoW specific
"sha3Uncles": ethtypes.EmptyUncleHash, // No uncles in Tendermint
"logsBloom": bloom,
"stateRoot": hexutil.Bytes(header.AppHash),
"miner": validatorAddr,
"mixHash": common.Hash{},
"difficulty": (*hexutil.Big)(big.NewInt(0)),
"extraData": "0x",
"size": hexutil.Uint64(size),
"gasLimit": hexutil.Uint64(gasLimit), // Static gas limit
"gasUsed": (*hexutil.Big)(gasUsed),
"timestamp": hexutil.Uint64(header.Time.Unix()),
"transactionsRoot": transactionsRoot,
"receiptsRoot": ethtypes.EmptyRootHash,
"uncles": []common.Hash{},
"transactions": transactions,
"totalDifficulty": (*hexutil.Big)(big.NewInt(0)),
}
if baseFee != nil {
result["baseFeePerGas"] = (*hexutil.Big)(baseFee)
}
return result
}
// NewTransactionFromMsg returns a transaction that will serialize to the RPC
// from incomplete message for cosmos EVM transactions.
func NewTransactionFromMsg(
msg *evmtypes.MsgEthereumTx,
blockHash common.Hash,
blockNumber, index uint64,
baseFee *big.Int,
chainID *big.Int,
txAdditional *TxResultAdditionalFields,
) (*RPCTransaction, error) {
tx := msg.AsTransaction()
if tx == nil {
return NewRPCTransactionFromIncompleteMsg(msg, blockHash, blockNumber, index, baseFee, chainID, txAdditional)
}
return NewRPCTransaction(tx, blockHash, blockNumber, index, baseFee, chainID)
}
// NewTransactionFromData returns a transaction that will serialize to the RPC
// representation, with the given location metadata set (if available).
func NewRPCTransaction(
tx *ethtypes.Transaction, blockHash common.Hash, blockNumber, index uint64, baseFee *big.Int,
chainID *big.Int,
) (*RPCTransaction, error) {
// Determine the signer. For replay-protected transactions, use the most permissive
// signer, because we assume that signers are backwards-compatible with old
// transactions. For non-protected transactions, the homestead signer signer is used
// because the return value of ChainId is zero for those transactions.
var signer ethtypes.Signer
if tx.Protected() {
signer = ethtypes.LatestSignerForChainID(tx.ChainId())
} else {
signer = ethtypes.HomesteadSigner{}
}
from, err := ethtypes.Sender(signer, tx)
if err != nil {
return nil, err
}
v, r, s := tx.RawSignatureValues()
result := &RPCTransaction{
Type: hexutil.Uint64(tx.Type()),
From: from,
Gas: hexutil.Uint64(tx.Gas()),
GasPrice: (*hexutil.Big)(tx.GasPrice()),
Hash: tx.Hash(),
Input: hexutil.Bytes(tx.Data()),
Nonce: hexutil.Uint64(tx.Nonce()),
To: tx.To(),
Value: (*hexutil.Big)(tx.Value()),
V: (*hexutil.Big)(v),
R: (*hexutil.Big)(r),
S: (*hexutil.Big)(s),
ChainID: (*hexutil.Big)(chainID),
}
if blockHash != (common.Hash{}) {
result.BlockHash = &blockHash
result.BlockNumber = (*hexutil.Big)(new(big.Int).SetUint64(blockNumber))
result.TransactionIndex = (*hexutil.Uint64)(&index)
}
switch tx.Type() {
case ethtypes.AccessListTxType:
al := tx.AccessList()
result.Accesses = &al
result.ChainID = (*hexutil.Big)(tx.ChainId())
case ethtypes.DynamicFeeTxType:
al := tx.AccessList()
result.Accesses = &al
result.ChainID = (*hexutil.Big)(tx.ChainId())
result.GasFeeCap = (*hexutil.Big)(tx.GasFeeCap())
result.GasTipCap = (*hexutil.Big)(tx.GasTipCap())
// if the transaction has been mined, compute the effective gas price
if baseFee != nil && blockHash != (common.Hash{}) {
// price = min(tip, gasFeeCap - baseFee) + baseFee
price := math.BigMin(new(big.Int).Add(tx.GasTipCap(), baseFee), tx.GasFeeCap())
result.GasPrice = (*hexutil.Big)(price)
} else {
result.GasPrice = (*hexutil.Big)(tx.GasFeeCap())
}
}
return result, nil
}
// NewRPCTransactionFromIncompleteMsg returns a transaction that will serialize to the RPC
// representation, with the given location metadata set (if available).
func NewRPCTransactionFromIncompleteMsg(
msg *evmtypes.MsgEthereumTx, blockHash common.Hash, blockNumber, index uint64, baseFee *big.Int,
chainID *big.Int, txAdditional *TxResultAdditionalFields,
) (*RPCTransaction, error) {
to := &common.Address{}
*to = txAdditional.Recipient
result := &RPCTransaction{
Type: hexutil.Uint64(txAdditional.Type),
From: common.HexToAddress(msg.From),
Gas: hexutil.Uint64(txAdditional.GasUsed),
GasPrice: (*hexutil.Big)(baseFee),
Hash: common.HexToHash(msg.Hash),
Input: []byte{},
Nonce: 0, // TODO: get nonce for "from" from ethermint
To: to,
Value: (*hexutil.Big)(txAdditional.Value),
V: nil,
R: nil,
S: nil,
ChainID: (*hexutil.Big)(chainID),
}
if blockHash != (common.Hash{}) {
result.BlockHash = &blockHash
result.BlockNumber = (*hexutil.Big)(new(big.Int).SetUint64(blockNumber))
result.TransactionIndex = (*hexutil.Uint64)(&index)
}
return result, nil
}
// BaseFeeFromEvents parses the feemarket basefee from cosmos events
func BaseFeeFromEvents(events []abci.Event) *big.Int {
for _, event := range events {
if event.Type != feemarkettypes.EventTypeFeeMarket {
continue
}
for _, attr := range event.Attributes {
if bytes.Equal(attr.Key, []byte(feemarkettypes.AttributeKeyBaseFee)) {
result, success := new(big.Int).SetString(string(attr.Value), 10)
if success {
return result
}
return nil
}
}
}
return nil
}
// CheckTxFee is an internal function used to check whether the fee of
// the given transaction is _reasonable_(under the cap).
func CheckTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
// Short circuit if there is no cap for transaction fee at all.
if cap == 0 {
return nil
}
totalfee := new(big.Float).SetInt(new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(gas)))
// 1 photon in 10^18 aphoton
oneToken := new(big.Float).SetInt(big.NewInt(params.Ether))
// quo = rounded(x/y)
feeEth := new(big.Float).Quo(totalfee, oneToken)
// no need to check error from parsing
feeFloat, _ := feeEth.Float64()
if feeFloat > cap {
return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, cap)
}
return nil
}
// TxExceedBlockGasLimit returns true if the tx exceeds block gas limit.
func TxExceedBlockGasLimit(res *abci.ResponseDeliverTx) bool {
return strings.Contains(res.Log, ExceedBlockGasLimitError)
}
// TxSuccessOrExceedsBlockGasLimit returns true if the transaction was successful
// or if it failed with an ExceedBlockGasLimit error
func TxSuccessOrExceedsBlockGasLimit(res *abci.ResponseDeliverTx) bool {
return res.Code == 0 || TxExceedBlockGasLimit(res)
}
// Copyright 2021 Evmos Foundation
// This file is part of Evmos' Ethermint library.
//
// The Ethermint library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Ethermint library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package config
import (
"errors"
"fmt"
"path"
"time"
"github.com/spf13/viper"
"github.com/tendermint/tendermint/libs/strings"
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/server/config"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
)
const (
// DefaultGRPCAddress is the default address the gRPC server binds to.
DefaultGRPCAddress = "0.0.0.0:9900"
// DefaultJSONRPCAddress is the default address the JSON-RPC server binds to.
DefaultJSONRPCAddress = "127.0.0.1:8545"
// DefaultJSONRPCWsAddress is the default address the JSON-RPC WebSocket server binds to.
DefaultJSONRPCWsAddress = "127.0.0.1:8546"
// DefaultJsonRPCMetricsAddress is the default address the JSON-RPC Metrics server binds to.
DefaultJSONRPCMetricsAddress = "127.0.0.1:6065"
// DefaultEVMTracer is the default vm.Tracer type
DefaultEVMTracer = ""
// DefaultFixRevertGasRefundHeight is the default height at which to overwrite gas refund
DefaultFixRevertGasRefundHeight = 0
DefaultMaxTxGasWanted = 0
DefaultGasCap uint64 = 25000000
DefaultFilterCap int32 = 200
DefaultFeeHistoryCap int32 = 100
DefaultLogsCap int32 = 10000
DefaultBlockRangeCap int32 = 10000
DefaultEVMTimeout = 5 * time.Second
// default 1.0 eth
DefaultTxFeeCap float64 = 1.0
DefaultHTTPTimeout = 30 * time.Second
DefaultHTTPIdleTimeout = 120 * time.Second
// DefaultAllowUnprotectedTxs value is false
DefaultAllowUnprotectedTxs = false
// DefaultMaxOpenConnections represents the amount of open connections (unlimited = 0)
DefaultMaxOpenConnections = 0
)
var evmTracers = []string{"json", "markdown", "struct", "access_list"}
// Config defines the server's top level configuration. It includes the default app config
// from the SDK as well as the EVM configuration to enable the JSON-RPC APIs.
type Config struct {
config.Config
EVM EVMConfig `mapstructure:"evm"`
JSONRPC JSONRPCConfig `mapstructure:"json-rpc"`
TLS TLSConfig `mapstructure:"tls"`
}
// EVMConfig defines the application configuration values for the EVM.
type EVMConfig struct {
// Tracer defines vm.Tracer type that the EVM will use if the node is run in
// trace mode. Default: 'json'.
Tracer string `mapstructure:"tracer"`
// MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode.
MaxTxGasWanted uint64 `mapstructure:"max-tx-gas-wanted"`
}
// JSONRPCConfig defines configuration for the EVM RPC server.
type JSONRPCConfig struct {
// API defines a list of JSON-RPC namespaces that should be enabled
API []string `mapstructure:"api"`
// Address defines the HTTP server to listen on
Address string `mapstructure:"address"`
// WsAddress defines the WebSocket server to listen on
WsAddress string `mapstructure:"ws-address"`
// GasCap is the global gas cap for eth-call variants.
GasCap uint64 `mapstructure:"gas-cap"`
// EVMTimeout is the global timeout for eth-call.
EVMTimeout time.Duration `mapstructure:"evm-timeout"`
// TxFeeCap is the global tx-fee cap for send transaction
TxFeeCap float64 `mapstructure:"txfee-cap"`
// FilterCap is the global cap for total number of filters that can be created.
FilterCap int32 `mapstructure:"filter-cap"`
// FeeHistoryCap is the global cap for total number of blocks that can be fetched
FeeHistoryCap int32 `mapstructure:"feehistory-cap"`
// Enable defines if the EVM RPC server should be enabled.
Enable bool `mapstructure:"enable"`
// LogsCap defines the max number of results can be returned from single `eth_getLogs` query.
LogsCap int32 `mapstructure:"logs-cap"`
// BlockRangeCap defines the max block range allowed for `eth_getLogs` query.
BlockRangeCap int32 `mapstructure:"block-range-cap"`
// HTTPTimeout is the read/write timeout of http json-rpc server.
HTTPTimeout time.Duration `mapstructure:"http-timeout"`
// HTTPIdleTimeout is the idle timeout of http json-rpc server.
HTTPIdleTimeout time.Duration `mapstructure:"http-idle-timeout"`
// AllowUnprotectedTxs restricts unprotected (non EIP155 signed) transactions to be submitted via
// the node's RPC when global parameter is disabled.
AllowUnprotectedTxs bool `mapstructure:"allow-unprotected-txs"`
// MaxOpenConnections sets the maximum number of simultaneous connections
// for the server listener.
MaxOpenConnections int `mapstructure:"max-open-connections"`
// EnableIndexer defines if enable the custom indexer service.
EnableIndexer bool `mapstructure:"enable-indexer"`
// MetricsAddress defines the metrics server to listen on
MetricsAddress string `mapstructure:"metrics-address"`
// FixRevertGasRefundHeight defines the upgrade height for fix of revert gas refund logic when transaction reverted
FixRevertGasRefundHeight int64 `mapstructure:"fix-revert-gas-refund-height"`
}
// TLSConfig defines the certificate and matching private key for the server.
type TLSConfig struct {
// CertificatePath the file path for the certificate .pem file
CertificatePath string `mapstructure:"certificate-path"`
// KeyPath the file path for the key .pem file
KeyPath string `mapstructure:"key-path"`
}
// AppConfig helps to override default appConfig template and configs.
// return "", nil if no custom configuration is required for the application.
func AppConfig(denom string) (string, interface{}) {
// Optionally allow the chain developer to overwrite the SDK's default
// server config.
srvCfg := config.DefaultConfig()
// The SDK's default minimum gas price is set to "" (empty value) inside
// app.toml. If left empty by validators, the node will halt on startup.
// However, the chain developer can set a default app.toml value for their
// validators here.
//
// In summary:
// - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their
// own app.toml config,
// - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their
// own app.toml to override, or use this default value.
//
// In ethermint, we set the min gas prices to 0.
if denom != "" {
srvCfg.MinGasPrices = "0" + denom
}
customAppConfig := Config{
Config: *srvCfg,
EVM: *DefaultEVMConfig(),
JSONRPC: *DefaultJSONRPCConfig(),
TLS: *DefaultTLSConfig(),
}
customAppTemplate := config.DefaultConfigTemplate + DefaultConfigTemplate
return customAppTemplate, customAppConfig
}
// DefaultConfig returns server's default configuration.
func DefaultConfig() *Config {
return &Config{
Config: *config.DefaultConfig(),
EVM: *DefaultEVMConfig(),
JSONRPC: *DefaultJSONRPCConfig(),
TLS: *DefaultTLSConfig(),
}
}
// DefaultEVMConfig returns the default EVM configuration
func DefaultEVMConfig() *EVMConfig {
return &EVMConfig{
Tracer: DefaultEVMTracer,
MaxTxGasWanted: DefaultMaxTxGasWanted,
}
}
// Validate returns an error if the tracer type is invalid.
func (c EVMConfig) Validate() error {
if c.Tracer != "" && !strings.StringInSlice(c.Tracer, evmTracers) {
return fmt.Errorf("invalid tracer type %s, available types: %v", c.Tracer, evmTracers)
}
return nil
}
// GetDefaultAPINamespaces returns the default list of JSON-RPC namespaces that should be enabled
func GetDefaultAPINamespaces() []string {
return []string{"eth", "net", "web3"}
}
// GetAPINamespaces returns the all the available JSON-RPC API namespaces.
func GetAPINamespaces() []string {
return []string{"web3", "eth", "personal", "net", "txpool", "debug", "miner"}
}
// DefaultJSONRPCConfig returns an EVM config with the JSON-RPC API enabled by default
func DefaultJSONRPCConfig() *JSONRPCConfig {
return &JSONRPCConfig{
Enable: true,
API: GetDefaultAPINamespaces(),
Address: DefaultJSONRPCAddress,
WsAddress: DefaultJSONRPCWsAddress,
GasCap: DefaultGasCap,
EVMTimeout: DefaultEVMTimeout,
TxFeeCap: DefaultTxFeeCap,
FilterCap: DefaultFilterCap,
FeeHistoryCap: DefaultFeeHistoryCap,
BlockRangeCap: DefaultBlockRangeCap,
LogsCap: DefaultLogsCap,
HTTPTimeout: DefaultHTTPTimeout,
HTTPIdleTimeout: DefaultHTTPIdleTimeout,
AllowUnprotectedTxs: DefaultAllowUnprotectedTxs,
MaxOpenConnections: DefaultMaxOpenConnections,
EnableIndexer: false,
MetricsAddress: DefaultJSONRPCMetricsAddress,
FixRevertGasRefundHeight: DefaultFixRevertGasRefundHeight,
}
}
// Validate returns an error if the JSON-RPC configuration fields are invalid.
func (c JSONRPCConfig) Validate() error {
if c.Enable && len(c.API) == 0 {
return errors.New("cannot enable JSON-RPC without defining any API namespace")
}
if c.FilterCap < 0 {
return errors.New("JSON-RPC filter-cap cannot be negative")
}
if c.FeeHistoryCap <= 0 {
return errors.New("JSON-RPC feehistory-cap cannot be negative or 0")
}
if c.TxFeeCap < 0 {
return errors.New("JSON-RPC tx fee cap cannot be negative")
}
if c.EVMTimeout < 0 {
return errors.New("JSON-RPC EVM timeout duration cannot be negative")
}
if c.LogsCap < 0 {
return errors.New("JSON-RPC logs cap cannot be negative")
}
if c.BlockRangeCap < 0 {
return errors.New("JSON-RPC block range cap cannot be negative")
}
if c.HTTPTimeout < 0 {
return errors.New("JSON-RPC HTTP timeout duration cannot be negative")
}
if c.HTTPIdleTimeout < 0 {
return errors.New("JSON-RPC HTTP idle timeout duration cannot be negative")
}
// check for duplicates
seenAPIs := make(map[string]bool)
for _, api := range c.API {
if seenAPIs[api] {
return fmt.Errorf("repeated API namespace '%s'", api)
}
seenAPIs[api] = true
}
return nil
}
// DefaultTLSConfig returns the default TLS configuration
func DefaultTLSConfig() *TLSConfig {
return &TLSConfig{
CertificatePath: "",
KeyPath: "",
}
}
// Validate returns an error if the TLS certificate and key file extensions are invalid.
func (c TLSConfig) Validate() error {
certExt := path.Ext(c.CertificatePath)
if c.CertificatePath != "" && certExt != ".pem" {
return fmt.Errorf("invalid extension %s for certificate path %s, expected '.pem'", certExt, c.CertificatePath)
}
keyExt := path.Ext(c.KeyPath)
if c.KeyPath != "" && keyExt != ".pem" {
return fmt.Errorf("invalid extension %s for key path %s, expected '.pem'", keyExt, c.KeyPath)
}
return nil
}
// GetConfig returns a fully parsed Config object.
func GetConfig(v *viper.Viper) (Config, error) {
cfg, err := config.GetConfig(v)
if err != nil {
return Config{}, err
}
return Config{
Config: cfg,
EVM: EVMConfig{
Tracer: v.GetString("evm.tracer"),
MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"),
},
JSONRPC: JSONRPCConfig{
Enable: v.GetBool("json-rpc.enable"),
API: v.GetStringSlice("json-rpc.api"),
Address: v.GetString("json-rpc.address"),
WsAddress: v.GetString("json-rpc.ws-address"),
GasCap: v.GetUint64("json-rpc.gas-cap"),
FilterCap: v.GetInt32("json-rpc.filter-cap"),
FeeHistoryCap: v.GetInt32("json-rpc.feehistory-cap"),
TxFeeCap: v.GetFloat64("json-rpc.txfee-cap"),
EVMTimeout: v.GetDuration("json-rpc.evm-timeout"),
LogsCap: v.GetInt32("json-rpc.logs-cap"),
BlockRangeCap: v.GetInt32("json-rpc.block-range-cap"),
HTTPTimeout: v.GetDuration("json-rpc.http-timeout"),
HTTPIdleTimeout: v.GetDuration("json-rpc.http-idle-timeout"),
MaxOpenConnections: v.GetInt("json-rpc.max-open-connections"),
EnableIndexer: v.GetBool("json-rpc.enable-indexer"),
MetricsAddress: v.GetString("json-rpc.metrics-address"),
FixRevertGasRefundHeight: v.GetInt64("json-rpc.fix-revert-gas-refund-height"),
},
TLS: TLSConfig{
CertificatePath: v.GetString("tls.certificate-path"),
KeyPath: v.GetString("tls.key-path"),
},
}, nil
}
// ParseConfig retrieves the default environment configuration for the
// application.
func ParseConfig(v *viper.Viper) (*Config, error) {
conf := DefaultConfig()
err := v.Unmarshal(conf)
return conf, err
}
// ValidateBasic returns an error any of the application configuration fields are invalid
func (c Config) ValidateBasic() error {
if err := c.EVM.Validate(); err != nil {
return errorsmod.Wrapf(errortypes.ErrAppConfig, "invalid evm config value: %s", err.Error())
}
if err := c.JSONRPC.Validate(); err != nil {
return errorsmod.Wrapf(errortypes.ErrAppConfig, "invalid json-rpc config value: %s", err.Error())
}
if err := c.TLS.Validate(); err != nil {
return errorsmod.Wrapf(errortypes.ErrAppConfig, "invalid tls config value: %s", err.Error())
}
return c.Config.ValidateBasic()
}
package sample
import (
"context"
"math/big"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/rlp"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/common/ethereum"
)
func Chain(chainID int64) *common.Chain {
r := newRandFromSeed(chainID)
return &common.Chain{
ChainName: common.ChainName(r.Intn(4)),
ChainId: chainID,
}
}
func PubKeySet() *common.PubKeySet {
pubKeySet := common.PubKeySet{
Secp256k1: common.PubKey(secp256k1.GenPrivKey().PubKey().Bytes()),
Ed25519: common.PubKey(ed25519.GenPrivKey().PubKey().String()),
}
return &pubKeySet
}
func EthHeader() (headerRLP []byte, err error) {
url := "https://rpc.ankr.com/eth_goerli"
client, err := ethclient.Dial(url)
if err != nil {
return
}
bn := int64(9889649)
block, err := client.BlockByNumber(context.Background(), big.NewInt(bn))
if err != nil {
return
}
headerRLP, _ = rlp.EncodeToBytes(block.Header())
return
}
func Proof() (txIndex int64, block *ethtypes.Block, header ethtypes.Header, headerRLP []byte, proof *common.Proof, tx *ethtypes.Transaction, err error) {
txIndex = int64(9)
url := "https://rpc.ankr.com/eth_goerli"
client, err := ethclient.Dial(url)
if err != nil {
return
}
bn := int64(9889649)
block, err = client.BlockByNumber(context.Background(), big.NewInt(bn))
if err != nil {
return
}
headerRLP, _ = rlp.EncodeToBytes(block.Header())
err = rlp.DecodeBytes(headerRLP, &header)
if err != nil {
return
}
tr := ethereum.NewTrie(block.Transactions())
var b []byte
ib := rlp.AppendUint64(b, uint64(txIndex))
p := ethereum.NewProof()
err = tr.Prove(ib, 0, p)
if err != nil {
return
}
proof = common.NewEthereumProof(p)
tx = block.Transactions()[txIndex]
return
}
package sample
import (
"math/rand"
"testing"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func OutTxTracker(t *testing.T, index string) types.OutTxTracker {
r := newRandFromStringSeed(t, index)
return types.OutTxTracker{
Index: index,
ChainId: r.Int63(),
Nonce: r.Uint64(),
}
}
func Tss() *types.TSS {
return &types.TSS{
TssPubkey: ed25519.GenPrivKey().PubKey().String(),
FinalizedZetaHeight: 1000,
KeyGenZetaHeight: 1000,
}
}
func GasPrice(t *testing.T, index string) *types.GasPrice {
r := newRandFromStringSeed(t, index)
return &types.GasPrice{
Creator: AccAddress(),
Index: index,
ChainId: r.Int63(),
Signers: []string{AccAddress(), AccAddress()},
BlockNums: []uint64{r.Uint64(), r.Uint64()},
Prices: []uint64{r.Uint64(), r.Uint64()},
MedianIndex: 0,
}
}
func ChainNonces(t *testing.T, index string) *types.ChainNonces {
r := newRandFromStringSeed(t, index)
return &types.ChainNonces{
Creator: AccAddress(),
Index: index,
ChainId: r.Int63(),
Nonce: r.Uint64(),
Signers: []string{AccAddress(), AccAddress()},
FinalizedHeight: r.Uint64(),
}
}
func InboundTxParams(r *rand.Rand) *types.InboundTxParams {
return &types.InboundTxParams{
Sender: EthAddress().String(),
SenderChainId: r.Int63(),
TxOrigin: EthAddress().String(),
CoinType: common.CoinType(r.Intn(100)),
Asset: StringRandom(r, 32),
Amount: math.NewUint(uint64(r.Int63())),
InboundTxObservedHash: StringRandom(r, 32),
InboundTxObservedExternalHeight: r.Uint64(),
InboundTxBallotIndex: StringRandom(r, 32),
InboundTxFinalizedZetaHeight: r.Uint64(),
}
}
func OutboundTxParams(r *rand.Rand) *types.OutboundTxParams {
return &types.OutboundTxParams{
Receiver: EthAddress().String(),
ReceiverChainId: r.Int63(),
CoinType: common.CoinType(r.Intn(100)),
Amount: math.NewUint(uint64(r.Int63())),
OutboundTxTssNonce: r.Uint64(),
OutboundTxGasLimit: r.Uint64(),
OutboundTxGasPrice: math.NewUint(uint64(r.Int63())).String(),
OutboundTxHash: StringRandom(r, 32),
OutboundTxBallotIndex: StringRandom(r, 32),
OutboundTxObservedExternalHeight: r.Uint64(),
OutboundTxGasUsed: r.Uint64(),
OutboundTxEffectiveGasPrice: math.NewInt(r.Int63()),
}
}
func Status(t *testing.T, index string) *types.Status {
r := newRandFromStringSeed(t, index)
return &types.Status{
Status: types.CctxStatus(r.Intn(100)),
StatusMessage: String(),
LastUpdateTimestamp: r.Int63(),
}
}
func CrossChainTx(t *testing.T, index string) *types.CrossChainTx {
r := newRandFromStringSeed(t, index)
return &types.CrossChainTx{
Creator: AccAddress(),
Index: index,
ZetaFees: math.NewUint(uint64(r.Int63())),
RelayedMessage: StringRandom(r, 32),
CctxStatus: Status(t, index),
InboundTxParams: InboundTxParams(r),
OutboundTxParams: []*types.OutboundTxParams{OutboundTxParams(r), OutboundTxParams(r)},
}
}
func LastBlockHeight(t *testing.T, index string) *types.LastBlockHeight {
r := newRandFromStringSeed(t, index)
return &types.LastBlockHeight{
Creator: AccAddress(),
Index: index,
Chain: StringRandom(r, 32),
LastSendHeight: r.Uint64(),
LastReceiveHeight: r.Uint64(),
}
}
func InTxHashToCctx(t *testing.T, inTxHash string) types.InTxHashToCctx {
r := newRandFromStringSeed(t, inTxHash)
return types.InTxHashToCctx{
InTxHash: inTxHash,
CctxIndex: []string{StringRandom(r, 32), StringRandom(r, 32)},
}
}
package sample
import (
"testing"
"cosmossdk.io/math"
"github.com/zeta-chain/zetacore/x/emissions/types"
)
func WithdrawableEmissions(t *testing.T) types.WithdrawableEmissions {
addr := AccAddress()
r := newRandFromStringSeed(t, addr)
return types.WithdrawableEmissions{
Address: AccAddress(),
Amount: math.NewInt(r.Int63()),
}
}
package sample
import (
"testing"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func ForeignCoins(t *testing.T, address string) types.ForeignCoins {
r := newRandFromStringSeed(t, address)
return types.ForeignCoins{
Zrc20ContractAddress: address,
Asset: EthAddress().String(),
ForeignChainId: r.Int63(),
Decimals: uint32(r.Uint64()),
Name: StringRandom(r, 32),
Symbol: StringRandom(r, 32),
CoinType: common.CoinType_ERC20,
GasLimit: r.Uint64(),
}
}
func SystemContract() *types.SystemContract {
return &types.SystemContract{
SystemContract: EthAddress().String(),
ConnectorZevm: EthAddress().String(),
}
}
package sample
import (
"testing"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/observer/types"
)
func Ballot(t *testing.T, index string) *types.Ballot {
r := newRandFromStringSeed(t, index)
return &types.Ballot{
Index: index,
BallotIdentifier: StringRandom(r, 32),
VoterList: []string{AccAddress(), AccAddress()},
Votes: []types.VoteType{types.VoteType_FailureObservation, types.VoteType_SuccessObservation},
ObservationType: types.ObservationType_EmptyObserverType,
BallotThreshold: sdk.NewDec(1),
BallotStatus: types.BallotStatus_BallotInProgress,
BallotCreationHeight: r.Int63(),
}
}
func ObserverMapper(t *testing.T, index string) *types.ObserverMapper {
r := newRandFromStringSeed(t, index)
return &types.ObserverMapper{
Index: index,
ObserverChain: Chain(r.Int63()),
ObserverList: []string{AccAddress(), AccAddress()},
}
}
func NodeAccount() *types.NodeAccount {
operator := AccAddress()
return &types.NodeAccount{
Operator: operator,
GranteeAddress: AccAddress(),
GranteePubkey: PubKeySet(),
NodeStatus: types.NodeStatus_Active,
}
}
func CrosschainFlags() *types.CrosschainFlags {
return &types.CrosschainFlags{
IsInboundEnabled: true,
IsOutboundEnabled: true,
}
}
func Keygen(t *testing.T) *types.Keygen {
pubKey := ed25519.GenPrivKey().PubKey().String()
r := newRandFromStringSeed(t, pubKey)
return &types.Keygen{
Status: types.KeygenStatus_KeyGenSuccess,
GranteePubkeys: []string{pubKey},
BlockNumber: r.Int63(),
}
}
func LastObserverCount(lastChangeHeight int64) *types.LastObserverCount {
r := newRandFromSeed(lastChangeHeight)
return &types.LastObserverCount{
Count: r.Uint64(),
LastChangeHeight: lastChangeHeight,
}
}
func CoreParams(chainID int64) *types.CoreParams {
r := newRandFromSeed(chainID)
return &types.CoreParams{
ChainId: chainID,
ConfirmationCount: r.Uint64(),
GasPriceTicker: r.Uint64(),
InTxTicker: r.Uint64(),
OutTxTicker: r.Uint64(),
WatchUtxoTicker: r.Uint64(),
ZetaTokenContractAddress: EthAddress().String(),
ConnectorContractAddress: EthAddress().String(),
Erc20CustodyContractAddress: EthAddress().String(),
OutboundTxScheduleInterval: r.Int63(),
OutboundTxScheduleLookahead: r.Int63(),
}
}
func CoreParamsList() (cpl types.CoreParamsList) {
chainList := common.DefaultChainsList()
for _, chain := range chainList {
cpl.CoreParams = append(cpl.CoreParams, CoreParams(chain.ChainId))
}
return
}
package sample
import (
"errors"
"hash/fnv"
"math/rand"
"strconv"
"testing"
"github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/common/cosmos"
)
var ErrSample = errors.New("sample error")
func newRandFromSeed(s int64) *rand.Rand {
// #nosec G404 test purpose - weak randomness is not an issue here
return rand.New(rand.NewSource(s))
}
func newRandFromStringSeed(t *testing.T, s string) *rand.Rand {
h := fnv.New64a()
_, err := h.Write([]byte(s))
require.NoError(t, err)
return newRandFromSeed(int64(h.Sum64()))
}
// PubKey returns a sample account PubKey
func PubKey(r *rand.Rand) cryptotypes.PubKey {
seed := []byte(strconv.Itoa(r.Int()))
return ed25519.GenPrivKeyFromSecret(seed).PubKey()
}
// Bech32AccAddress returns a sample account address
func Bech32AccAddress() sdk.AccAddress {
pk := ed25519.GenPrivKey().PubKey()
addr := pk.Address()
return sdk.AccAddress(addr)
}
// AccAddress returns a sample account address in string
func AccAddress() string {
pk := ed25519.GenPrivKey().PubKey()
addr := pk.Address()
return sdk.AccAddress(addr).String()
}
// ValAddress returns a sample validator operator address
func ValAddress(r *rand.Rand) sdk.ValAddress {
return sdk.ValAddress(PubKey(r).Address())
}
// Validator returns a sample staking validator
func Validator(t testing.TB, r *rand.Rand) stakingtypes.Validator {
seed := []byte(strconv.Itoa(r.Int()))
val, err := stakingtypes.NewValidator(
ValAddress(r),
ed25519.GenPrivKeyFromSecret(seed).PubKey(),
stakingtypes.Description{})
require.NoError(t, err)
return val
}
// PubKeyString returns a sample public key string
func PubKeyString() string {
priKey := ed25519.GenPrivKey()
s, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, priKey.PubKey())
if err != nil {
panic(err)
}
pubkey, err := common.NewPubKey(s)
if err != nil {
panic(err)
}
return pubkey.String()
}
// PrivKeyAddressPair returns a private key, address pair
func PrivKeyAddressPair() (*ed25519.PrivKey, sdk.AccAddress) {
privKey := ed25519.GenPrivKey()
addr := privKey.PubKey().Address()
return privKey, sdk.AccAddress(addr)
}
// EthAddress returns a sample ethereum address
func EthAddress() ethcommon.Address {
return ethcommon.BytesToAddress(sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()).Bytes())
}
// Bytes returns a sample byte array
func Bytes() []byte {
return []byte("sample")
}
// String returns a sample string
func String() string {
return "sample"
}
// StringRandom returns a sample string with random alphanumeric characters
func StringRandom(r *rand.Rand, length int) string {
const chars = "abcdefghijklmnopqrstuvwxyz0123456789"
result := make([]byte, length)
for i := range result {
result[i] = chars[r.Intn(len(chars))]
}
return string(result)
}
// Coins returns a sample sdk.Coins
func Coins() sdk.Coins {
return sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewInt(42)))
}
package cli
import (
"context"
"errors"
"fmt"
"strconv"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdListSend() *cobra.Command {
cmd := &cobra.Command{
Use: "list-cctx",
Short: "list all CCTX",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllCctxRequest{
Pagination: pageReq,
}
res, err := queryClient.CctxAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdPendingCctx() *cobra.Command {
cmd := &cobra.Command{
Use: "list-pending-cctx [chain-id]",
Short: "shows pending CCTX",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
chainID, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
params := &types.QueryAllCctxPendingRequest{
ChainId: chainID,
}
res, err := queryClient.CctxAllPending(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdShowSend() *cobra.Command {
cmd := &cobra.Command{
Use: "show-cctx [index]",
Short: "shows a CCTX",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetCctxRequest{
Index: args[0],
}
res, err := queryClient.Cctx(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// Transaction CLI /////////////////////////
//zetacored tx zetacore cctx-voter 0x96B05C238b99768F349135de0653b687f9c13fEE ETH 0x96B05C238b99768F349135de0653b687f9c13fEE ETH 1000000000000000000 0 message hash 100 --from=zeta --keyring-backend=test --yes --chain-id=localnet_101-1
func CmdCCTXInboundVoter() *cobra.Command {
cmd := &cobra.Command{
Use: "inbound-voter [sender] [senderChainID] [txOrigin] [receiver] [receiverChainID] [amount] [message] [inTxHash] [inBlockHeight] [coinType] [asset]",
Short: "Broadcast message sendVoter",
Args: cobra.ExactArgs(11),
RunE: func(cmd *cobra.Command, args []string) error {
argsSender := args[0]
argsSenderChain, err := strconv.ParseInt(args[1], 10, 64)
if err != nil {
return err
}
argsTxOrigin := args[2]
argsReceiver := args[3]
argsReceiverChain, err := strconv.ParseInt(args[4], 10, 64)
if err != nil {
return err
}
amount := math.NewUintFromString(args[5])
argsMessage := args[6]
argsInTxHash := args[7]
argsInBlockHeight, err := strconv.ParseUint(args[8], 10, 64)
if err != nil {
return err
}
coinType, ok := common.CoinType_value[args[9]]
if !ok {
return fmt.Errorf("wrong coin type %s", args[9])
}
argsCoinType := common.CoinType(coinType)
argsAsset := args[10]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgVoteOnObservedInboundTx(
clientCtx.GetFromAddress().String(),
argsSender,
argsSenderChain,
argsTxOrigin,
argsReceiver,
argsReceiverChain,
amount,
argsMessage,
argsInTxHash,
argsInBlockHeight,
250_000,
argsCoinType,
argsAsset,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
func CmdCCTXOutboundVoter() *cobra.Command {
cmd := &cobra.Command{
Use: "outbound-voter [sendHash] [outTxHash] [outBlockHeight] [outGasUsed] [outEffectiveGasPrice] [outEffectiveGasLimit] [valueReceived] [Status] [chain] [outTXNonce] [coinType]",
Short: "Broadcast message receiveConfirmation",
Args: cobra.ExactArgs(11),
RunE: func(cmd *cobra.Command, args []string) error {
argsSendHash := args[0]
argsOutTxHash := args[1]
argsOutBlockHeight, err := strconv.ParseUint(args[2], 10, 64)
if err != nil {
return err
}
argsOutGasUsed, err := strconv.ParseUint(args[3], 10, 64)
if err != nil {
return err
}
argsOutEffectiveGasPrice, ok := math.NewIntFromString(args[4])
if !ok {
return errors.New("invalid effective gas price, enter 0 if unused")
}
argsOutEffectiveGasLimit, err := strconv.ParseUint(args[5], 10, 64)
if err != nil {
return err
}
argsMMint := args[6]
var status common.ReceiveStatus
if args[7] == "0" {
status = common.ReceiveStatus_Success
} else if args[7] == "1" {
status = common.ReceiveStatus_Failed
} else {
return fmt.Errorf("wrong status")
}
chain, err := strconv.ParseInt(args[8], 10, 64)
if err != nil {
return err
}
outTxNonce, err := strconv.ParseUint(args[9], 10, 64)
if err != nil {
return err
}
coinType, ok := common.CoinType_value[args[10]]
if !ok {
return fmt.Errorf("wrong coin type %s", args[10])
}
argsCoinType := common.CoinType(coinType)
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgVoteOnObservedOutboundTx(
clientCtx.GetFromAddress().String(),
argsSendHash,
argsOutTxHash,
argsOutBlockHeight,
argsOutGasUsed,
argsOutEffectiveGasPrice,
argsOutEffectiveGasLimit,
math.NewUintFromString(argsMMint),
status,
chain,
outTxNonce,
argsCoinType,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdListChainNonces() *cobra.Command {
cmd := &cobra.Command{
Use: "list-chain-nonces",
Short: "list all chainNonces",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllChainNoncesRequest{
Pagination: pageReq,
}
res, err := queryClient.ChainNoncesAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdShowChainNonces() *cobra.Command {
cmd := &cobra.Command{
Use: "show-chain-nonces [index]",
Short: "shows a chainNonces",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetChainNoncesRequest{
Index: args[0],
}
res, err := queryClient.ChainNonces(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdListPendingNonces() *cobra.Command {
cmd := &cobra.Command{
Use: "list-pending-nonces",
Short: "shows a chainNonces",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllPendingNoncesRequest{}
res, err := queryClient.PendingNoncesAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// Transaction CLI /////////////////////////
func CmdNonceVoter() *cobra.Command {
cmd := &cobra.Command{
Use: "nonce-voter [chain] [nonce]",
Short: "Broadcast message nonceVoter",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
argsChain, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
argsNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgNonceVoter(clientCtx.GetFromAddress().String(), argsChain, argsNonce)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdListGasPrice() *cobra.Command {
cmd := &cobra.Command{
Use: "list-gas-price",
Short: "list all gasPrice",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllGasPriceRequest{
Pagination: pageReq,
}
res, err := queryClient.GasPriceAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdShowGasPrice() *cobra.Command {
cmd := &cobra.Command{
Use: "show-gas-price [index]",
Short: "shows a gasPrice",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetGasPriceRequest{
Index: args[0],
}
res, err := queryClient.GasPrice(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// Transaction CLI /////////////////////////
func CmdGasPriceVoter() *cobra.Command {
cmd := &cobra.Command{
Use: "gas-price-voter [chain] [price] [supply] [blockNumber]",
Short: "Broadcast message gasPriceVoter",
Args: cobra.ExactArgs(4),
RunE: func(cmd *cobra.Command, args []string) error {
argsChain, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
argsPrice, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
argsSupply := args[2]
argsBlockNumber, err := strconv.ParseUint(args[3], 10, 64)
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgGasPriceVoter(clientCtx.GetFromAddress().String(), argsChain, argsPrice, argsSupply, argsBlockNumber)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdAddToInTxTracker() *cobra.Command {
cmd := &cobra.Command{
Use: "add-to-in-tx-tracker [chain-id] [tx-hash] [coin-type]",
Short: `Add a in-tx-tracker
Use 0:Zeta,1:Gas,2:ERC20`,
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argChain, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
argTxHash := args[1]
argsCoinType, err := common.GetCoinType(args[2])
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgAddToInTxTracker(
clientCtx.GetFromAddress().String(),
argChain,
argsCoinType,
argTxHash,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
func CmdListInTxTrackerByChain() *cobra.Command {
cmd := &cobra.Command{
Use: "list-in-tx-tracker [chainId]",
Short: "shows a list of in tx tracker by chainId",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
argChain, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params := &types.QueryAllInTxTrackerByChainRequest{
ChainId: argChain,
Pagination: pageReq,
}
res, err := queryClient.InTxTrackerAllByChain(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
return cmd
}
func CmdListInTxTrackers() *cobra.Command {
cmd := &cobra.Command{
Use: "list-all-in-tx-trackers",
Short: "shows all inTxTrackers",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllInTxTrackersRequest{}
res, err := queryClient.InTxTrackerAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdListLastBlockHeight() *cobra.Command {
cmd := &cobra.Command{
Use: "list-last-block-height",
Short: "list all lastBlockHeight",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllLastBlockHeightRequest{
Pagination: pageReq,
}
res, err := queryClient.LastBlockHeightAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdShowLastBlockHeight() *cobra.Command {
cmd := &cobra.Command{
Use: "show-last-block-height [index]",
Short: "shows a lastBlockHeight",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetLastBlockHeightRequest{
Index: args[0],
}
res, err := queryClient.LastBlockHeight(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdListOutTxTracker() *cobra.Command {
cmd := &cobra.Command{
Use: "list-out-tx-tracker",
Short: "list all OutTxTracker",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllOutTxTrackerRequest{
Pagination: pageReq,
}
res, err := queryClient.OutTxTrackerAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdShowOutTxTracker() *cobra.Command {
cmd := &cobra.Command{
Use: "show-out-tx-tracker [chainId] [nonce]",
Short: "shows a OutTxTracker",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
argChain, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
argNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
params := &types.QueryGetOutTxTrackerRequest{
ChainID: argChain,
Nonce: argNonce,
}
res, err := queryClient.OutTxTracker(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// Transaction CLI /////////////////////////
func CmdAddToWatchList() *cobra.Command {
cmd := &cobra.Command{
Use: "add-to-out-tx-tracker [chain] [nonce] [tx-hash]",
Short: "Add a out-tx-tracker",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argChain, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
argNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
argTxHash := args[2]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgAddToOutTxTracker(
clientCtx.GetFromAddress().String(),
argChain,
argNonce,
argTxHash,
nil, // TODO: add option to provide a proof from CLI arguments https://github.com/zeta-chain/node/issues/1134
"",
-1,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
func CmdRemoveFromWatchList() *cobra.Command {
cmd := &cobra.Command{
Use: "remove-from-out-tx-tracker [chain] [nonce]",
Short: "Remove a out-tx-tracker",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argChain, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
argNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgRemoveFromOutTxTracker(
clientCtx.GetFromAddress().String(),
argChain,
argNonce,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Short: "shows the parameters of the module",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"fmt"
"strconv"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cast"
"github.com/zeta-chain/zetacore/common"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdShowTSS() *cobra.Command {
cmd := &cobra.Command{
Use: "show-tss",
Short: "shows a TSS",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetTSSRequest{}
res, err := queryClient.TSS(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdListTssHistory() *cobra.Command {
cmd := &cobra.Command{
Use: "list-tss-history",
Short: "show historical list of TSS",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryTssHistoryRequest{}
res, err := queryClient.TssHistory(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// Transaction CLI /////////////////////////
func CmdCreateTSSVoter() *cobra.Command {
cmd := &cobra.Command{
Use: "create-tss-voter [pubkey] [keygenBlock] [status]",
Short: "Create a new TSSVoter",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
argsPubkey, err := cast.ToStringE(args[0])
if err != nil {
return err
}
keygenBlock, err := strconv.ParseInt(args[1], 10, 64)
if err != nil {
return err
}
var status common.ReceiveStatus
if args[2] == "0" {
status = common.ReceiveStatus_Success
} else if args[2] == "1" {
status = common.ReceiveStatus_Failed
} else {
return fmt.Errorf("wrong status")
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgCreateTSSVoter(clientCtx.GetFromAddress().String(), argsPubkey, keygenBlock, status)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
func CmdUpdateTss() *cobra.Command {
cmd := &cobra.Command{
Use: "update-tss-address [pubkey]",
Short: "Create a new TSSVoter",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
argsPubkey, err := cast.ToStringE(args[0])
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgUpdateTssAddress(clientCtx.GetFromAddress().String(), argsPubkey)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
func CmdMigrateTssFunds() *cobra.Command {
cmd := &cobra.Command{
Use: "migrate-tss-funds [chainID] [amount]",
Short: "Migrate TSS funds to the latest TSS address",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
argsChainID, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
argsAmount := math.NewUintFromString(args[1])
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgMigrateTssFunds(clientCtx.GetFromAddress().String(), argsChainID, argsAmount)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package cli
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdLastZetaHeight() *cobra.Command {
cmd := &cobra.Command{
Use: "last-zeta-height",
Short: "Query last Zeta Height",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryLastZetaHeightRequest{}
res, err := queryClient.LastZetaHeight(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"fmt"
// "strings"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
// sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
// GetQueryCmd returns the cli query commands for this module
func GetQueryCmd(_ string) *cobra.Command {
// Group crosschain queries under a subcommand
cmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
CmdListOutTxTracker(),
CmdShowOutTxTracker(),
CmdShowTSS(),
CmdListGasPrice(),
CmdShowGasPrice(),
CmdListChainNonces(),
CmdShowChainNonces(),
CmdListSend(),
CmdShowSend(),
CmdLastZetaHeight(),
CmdInTxHashToCctxData(),
CmdListInTxHashToCctx(),
CmdShowInTxHashToCctx(),
CmdQueryParams(),
CmdGetTssAddress(),
CmdListTssHistory(),
CmdListPendingNonces(),
CmdPendingCctx(),
CmdListInTxTrackerByChain(),
CmdListInTxTrackers(),
)
return cmd
}
package cli
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdGetTssAddress() *cobra.Command {
cmd := &cobra.Command{
Use: "get-tss-address [tss-pubkey]",
Short: "Query current tss address",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
tssPubKey := ""
if len(args) == 1 {
tssPubKey = args[0]
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetTssAddressRequest{
TssPubKey: tssPubKey,
}
res, err := queryClient.GetTssAddress(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func CmdListInTxHashToCctx() *cobra.Command {
cmd := &cobra.Command{
Use: "list-in-tx-hash-to-cctx",
Short: "list all inTxHashToCctx",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllInTxHashToCctxRequest{
Pagination: pageReq,
}
res, err := queryClient.InTxHashToCctxAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdShowInTxHashToCctx() *cobra.Command {
cmd := &cobra.Command{
Use: "show-in-tx-hash-to-cctx [in-tx-hash]",
Short: "shows a inTxHashToCctx",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
argInTxHash := args[0]
params := &types.QueryGetInTxHashToCctxRequest{
InTxHash: argInTxHash,
}
res, err := queryClient.InTxHashToCctx(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdInTxHashToCctxData() *cobra.Command {
cmd := &cobra.Command{
Use: "in-tx-hash-to-cctx-data [in-tx-hash]",
Short: "query a cctx data from a in tx hash",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
argInTxHash := args[0]
params := &types.QueryInTxHashToCctxDataRequest{
InTxHash: argInTxHash,
}
res, err := queryClient.InTxHashToCctxData(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"fmt"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
// GetTxCmd returns the transaction commands for this module
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
CmdAddToWatchList(),
CmdCreateTSSVoter(),
CmdGasPriceVoter(),
CmdNonceVoter(),
CmdCCTXOutboundVoter(),
CmdCCTXInboundVoter(),
CmdRemoveFromWatchList(),
CmdUpdateTss(),
CmdMigrateTssFunds(),
CmdAddToInTxTracker(),
)
return cmd
}
//go:build TESTNET
// +build TESTNET
package integrationtests
import (
"fmt"
"os"
"strconv"
"testing"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/stretchr/testify/require"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/testutil/network"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/testutil"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
)
func TxSignExec(clientCtx client.Context, from fmt.Stringer, filename string, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{
fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest),
fmt.Sprintf("--from=%s", from.String()),
fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID),
filename,
}
cmd := authcli.GetSignCommand()
tmcli.PrepareBaseCmd(cmd, "", "")
return clitestutil.ExecTestCLICmd(clientCtx, cmd, append(args, extraArgs...))
}
func WriteToNewTempFile(t testing.TB, s string) *os.File {
t.Helper()
fp := TempFile(t)
_, err := fp.WriteString(s)
require.Nil(t, err)
return fp
}
// TempFile returns a writable temporary file for the test to use.
func TempFile(t testing.TB) *os.File {
t.Helper()
fp, err := os.CreateTemp(GetTempDir(t), "")
require.NoError(t, err)
return fp
}
// GetTempDir returns a writable temporary director for the test to use.
func GetTempDir(t testing.TB) string {
t.Helper()
// os.MkDir() is used instead of testing.T.TempDir()
// see https://github.com/cosmos/cosmos-sdk/pull/8475 and
// https://github.com/cosmos/cosmos-sdk/pull/10341 for
// this change's rationale.
tempdir, err := os.MkdirTemp("", "")
require.NoError(t, err)
t.Cleanup(func() { _ = os.RemoveAll(tempdir) })
return tempdir
}
func BuildSignedGasPriceVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI) *os.File {
cmd := cli.CmdGasPriceVoter()
inboundVoterArgs := []string{
strconv.FormatInt(common.GoerliChain().ChainId, 10),
"10000000000",
"100",
"100",
}
txArgs := []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=true", flags.FlagGenerateOnly),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(10))).String()),
}
args := append(inboundVoterArgs, txArgs...)
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args)
require.NoError(t, err)
unsignerdTx := WriteToNewTempFile(t, out.String())
res, err := TxSignExec(val.ClientCtx, val.Address, unsignerdTx.Name(),
"--offline", "--account-number", strconv.FormatUint(account.GetAccountNumber(), 10), "--sequence", strconv.FormatUint(account.GetSequence(), 10))
require.NoError(t, err)
return WriteToNewTempFile(t, res.String())
}
func BuildSignedTssVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI) *os.File {
cmd := cli.CmdCreateTSSVoter()
inboundVoterArgs := []string{
"tsspubkey",
strconv.FormatInt(common.GoerliChain().ChainId, 10),
"0",
}
txArgs := []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=true", flags.FlagGenerateOnly),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(10))).String()),
}
args := append(inboundVoterArgs, txArgs...)
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args)
require.NoError(t, err)
unsignerdTx := WriteToNewTempFile(t, out.String())
res, err := TxSignExec(val.ClientCtx, val.Address, unsignerdTx.Name(),
"--offline", "--account-number", strconv.FormatUint(account.GetAccountNumber(), 10), "--sequence", strconv.FormatUint(account.GetSequence(), 10))
require.NoError(t, err)
return WriteToNewTempFile(t, res.String())
}
func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, nonce uint64,
cctxIndex, outTxHash, valueReceived, status string) *os.File {
cmd := cli.CmdCCTXOutboundVoter()
outboundVoterArgs := []string{
cctxIndex,
outTxHash,
"1",
"0",
"0",
"0",
valueReceived,
status,
strconv.FormatInt(common.GoerliChain().ChainId, 10),
strconv.FormatUint(nonce, 10),
"Zeta",
}
txArgs := []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=true", flags.FlagGenerateOnly),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(10))).String()),
}
args := append(outboundVoterArgs, txArgs...)
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args)
require.NoError(t, err)
unsignerdTx := WriteToNewTempFile(t, out.String())
res, err := TxSignExec(val.ClientCtx, val.Address, unsignerdTx.Name(),
"--offline", "--account-number", strconv.FormatUint(account.GetAccountNumber(), 10), "--sequence", strconv.FormatUint(account.GetSequence(), 10))
require.NoError(t, err)
return WriteToNewTempFile(t, res.String())
}
func BuildSignedInboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, message string) *os.File {
cmd := cli.CmdCCTXInboundVoter()
inboundVoterArgs := []string{
"0x96B05C238b99768F349135de0653b687f9c13fEE",
strconv.FormatInt(common.GoerliChain().ChainId, 10),
"0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7",
"0x96B05C238b99768F349135de0653b687f9c13fEE",
strconv.FormatInt(common.GoerliChain().ChainId, 10),
"10000000000000000000",
message,
"0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680",
"100",
"Zeta",
"",
}
txArgs := []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=true", flags.FlagGenerateOnly),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(10))).String()),
}
args := append(inboundVoterArgs, txArgs...)
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args)
require.NoError(t, err)
unsignerdTx := WriteToNewTempFile(t, out.String())
res, err := TxSignExec(val.ClientCtx, val.Address, unsignerdTx.Name(),
"--offline", "--account-number", strconv.FormatUint(account.GetAccountNumber(), 10), "--sequence", strconv.FormatUint(account.GetSequence(), 10))
require.NoError(t, err)
return WriteToNewTempFile(t, res.String())
}
func GetBallotIdentifier(message string) string {
msg := types.NewMsgVoteOnObservedInboundTx(
"",
"0x96B05C238b99768F349135de0653b687f9c13fEE",
common.GoerliChain().ChainId,
"0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7",
"0x96B05C238b99768F349135de0653b687f9c13fEE",
common.GoerliChain().ChainId,
sdk.NewUint(10000000000000000000),
message,
"0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680",
100,
250_000,
common.CoinType_Zeta,
"",
)
return msg.Digest()
}
func GetBallotIdentifierOutBound(nonce uint64, cctxindex, outtxHash, valueReceived string) string {
msg := types.NewMsgVoteOnObservedOutboundTx(
"",
cctxindex,
outtxHash,
1,
0,
math.ZeroInt(),
0,
math.NewUintFromString(valueReceived),
0,
common.GoerliChain().ChainId,
nonce,
common.CoinType_Zeta,
)
return msg.Digest()
}
//go:build TESTNET
// +build TESTNET
package integrationtests
import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcfg "github.com/evmos/ethermint/cmd/config"
"github.com/stretchr/testify/suite"
"github.com/zeta-chain/zetacore/app"
cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/testutil/network"
)
type IntegrationTestSuite struct {
suite.Suite
cfg network.Config
network *network.Network
}
func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
return &IntegrationTestSuite{cfg: cfg}
}
func (s *IntegrationTestSuite) Setconfig() {
config := sdk.GetConfig()
cmdcfg.SetBech32Prefixes(config)
ethcfg.SetBip44CoinType(config)
// Make sure address is compatible with ethereum
config.SetAddressVerifier(app.VerifyAddressFormat)
config.Seal()
}
func (s *IntegrationTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")
s.Setconfig()
minOBsDel, ok := sdk.NewIntFromString("100000000000000000000")
s.Require().True(ok)
s.cfg.StakingTokens = minOBsDel.Mul(sdk.NewInt(int64(10)))
s.cfg.BondedTokens = minOBsDel
observerList := []string{"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax",
"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2",
"zeta1szrskhdeleyt6wmn0nfxvcvt2l6f4fn06uaga4",
"zeta16h3y7s7030l4chcznwq3n6uz2m9wvmzu5vwt7c",
"zeta1xl2rfsrmx8nxryty3lsjuxwdxs59cn2q65e5ca",
"zeta1ktmprjdvc72jq0mpu8tn8sqx9xwj685qx0q6kt",
"zeta1ygeyr8pqfjvclxay5234gulnjzv2mkz6lph9y4",
"zeta1zegyenj7xg5nck04ykkzndm2qxdzc6v83mklsy",
"zeta1us2qpqdcctk6q7qv2c9d9jvjxlv88jscf68kav",
"zeta1e9fyaulgntkrnqnl0es4nyxghp3petpn2ntu3t",
}
network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, true)
network.AddCrosschainData(s.T(), 0, s.cfg.GenesisState, s.cfg.Codec)
net, err := network.New(s.T(), app.NodeDir, s.cfg)
s.Assert().NoError(err)
s.network = net
time.Sleep(3 * time.Second)
_, err = s.network.WaitForHeight(1)
s.Require().NoError(err)
}
func (s *IntegrationTestSuite) TearDownSuite() {
s.T().Log("tearing down integration test suite")
s.network.Cleanup()
}
package querytests
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestListCCTX() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.CrossChainTxs
request := func(next []byte, offset, limit uint64, total bool) []string {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
if next == nil {
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset))
} else {
args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next))
}
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit))
if total {
args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal))
}
return args
}
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSend(), args)
s.Require().NoError(err)
var resp types.QueryAllCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Require().Equal(objs[j], resp.CrossChainTx[j-i])
}
}
})
s.Run("ByKey", func() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSend(), args)
s.Require().NoError(err)
var resp types.QueryAllCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Assert().Equal(objs[j], resp.CrossChainTx[j-i])
}
next = resp.Pagination.NextKey
}
})
s.Run("Total", func() {
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSend(), args)
s.Require().NoError(err)
var resp types.QueryAllCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
// #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.CrossChainTx)
})
}
func (s *CliTestSuite) TestShowSend() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.CrossChainTxs
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
id string
args []string
err error
obj *types.CrossChainTx
}{
{
desc: "found",
id: objs[0].Index,
args: common,
obj: objs[0],
},
{
desc: "not found",
id: "not_found",
args: common,
err: status.Error(codes.InvalidArgument, "not found"),
},
} {
tc := tc
s.Run(tc.desc, func() {
args := []string{tc.id}
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowSend(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp types.QueryGetCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.CrossChainTx)
s.Require().Equal(tc.obj, resp.CrossChainTx)
}
})
}
}
package querytests
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowChainNonces() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.ChainNoncesList
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
id string
args []string
err error
obj *types.ChainNonces
}{
{
desc: "found",
id: objs[0].Index,
args: common,
obj: objs[0],
},
{
desc: "not found",
id: "not_found",
args: common,
err: status.Error(codes.InvalidArgument, "not found"),
},
} {
tc := tc
s.Run(tc.desc, func() {
args := []string{tc.id}
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowChainNonces(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp types.QueryGetChainNoncesResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.ChainNonces)
s.Require().Equal(tc.obj, resp.ChainNonces)
}
})
}
}
func (s *CliTestSuite) TestListChainNonces() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.ChainNoncesList
request := func(next []byte, offset, limit uint64, total bool) []string {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
if next == nil {
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset))
} else {
args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next))
}
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit))
if total {
args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal))
}
return args
}
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListChainNonces(), args)
s.Require().NoError(err)
var resp types.QueryAllChainNoncesResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Assert().Equal(objs[j], resp.ChainNonces[j-i])
}
}
})
s.Run("ByKey", func() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListChainNonces(), args)
s.Require().NoError(err)
var resp types.QueryAllChainNoncesResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Assert().Equal(objs[j], resp.ChainNonces[j-i])
}
next = resp.Pagination.NextKey
}
})
s.Run("Total", func() {
// #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListChainNonces(), args)
s.Require().NoError(err)
var resp types.QueryAllChainNoncesResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
// #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.ChainNonces)
})
}
package querytests
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowGasPrice() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.GasPriceList
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
id string
args []string
err error
obj *types.GasPrice
}{
{
desc: "found",
id: objs[0].Index,
args: common,
obj: objs[0],
},
{
desc: "not found",
id: "not_found",
args: common,
err: status.Error(codes.InvalidArgument, "not found"),
},
} {
tc := tc
s.Run(tc.desc, func() {
args := []string{tc.id}
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowGasPrice(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp types.QueryGetGasPriceResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.GasPrice)
s.Require().Equal(tc.obj, resp.GasPrice)
}
})
}
}
func (s *CliTestSuite) TestListGasPrice() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.GasPriceList
request := func(next []byte, offset, limit uint64, total bool) []string {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
if next == nil {
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset))
} else {
args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next))
}
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit))
if total {
args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal))
}
return args
}
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGasPrice(), args)
s.Require().NoError(err)
var resp types.QueryAllGasPriceResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Assert().Equal(objs[j], resp.GasPrice[j-i])
}
}
})
s.Run("ByKey", func() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGasPrice(), args)
s.Require().NoError(err)
var resp types.QueryAllGasPriceResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Assert().Equal(objs[j], resp.GasPrice[j-i])
}
next = resp.Pagination.NextKey
}
})
s.Run("Total", func() {
// #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGasPrice(), args)
s.Require().NoError(err)
var resp types.QueryAllGasPriceResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
// #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.GasPrice)
})
}
package querytests
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/testutil/nullify"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func (s *CliTestSuite) TestListInTxTrackers() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.InTxTrackerList
s.Run("List all trackers", func() {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxTrackers(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxTrackersResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().Equal(len(objs), len(resp.InTxTracker))
s.Require().ElementsMatch(nullify.Fill(objs), nullify.Fill(resp.InTxTracker))
})
}
func (s *CliTestSuite) TestListInTxTrackersByChain() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.InTxTrackerList
request := func(next []byte, offset, limit uint64, total bool, chainID int) []string {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
if next == nil {
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset))
} else {
args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next))
}
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit))
if total {
args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal))
}
args = append(args, fmt.Sprintf("%d", chainID))
return args
}
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
// #nosec G701 always positive
args := request(nil, uint64(i), uint64(step), false, 5)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxTrackerByChain(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxTrackerByChainResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().LessOrEqual(len(resp.InTxTracker), step)
s.Require().Subset(nullify.Fill(objs),
nullify.Fill(resp.InTxTracker),
)
}
})
s.Run("ByKey", func() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
// #nosec G701 always positive
args := request(next, 0, uint64(step), false, 5)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxTrackerByChain(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxTrackerByChainResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().LessOrEqual(len(resp.InTxTracker), step)
s.Require().Subset(
nullify.Fill(objs),
nullify.Fill(resp.InTxTracker),
)
next = resp.Pagination.NextKey
}
})
s.Run("Total", func() {
args := request(nil, 0, uint64(len(objs)), true, 5)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxTrackerByChain(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxTrackerByChainResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
s.Require().Equal(uint64(len(objs)), resp.Pagination.Total)
s.Require().ElementsMatch(nullify.Fill(objs),
nullify.Fill(resp.InTxTracker),
)
})
s.Run("Incorrect Chain ID ", func() {
args := request(nil, 0, uint64(len(objs)), true, 15)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxTrackerByChain(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxTrackerByChainResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
s.Require().Equal(uint64(0), resp.Pagination.Total)
})
}
package querytests
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"google.golang.org/grpc/codes"
"strconv"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/testutil/nullify"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowInTxHashToCctx() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.InTxHashToCctxList
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
idInTxHash string
args []string
err error
obj types.InTxHashToCctx
}{
{
desc: "found",
idInTxHash: objs[0].InTxHash,
args: common,
obj: objs[0],
},
{
desc: "not found",
idInTxHash: strconv.Itoa(100000),
args: common,
err: status.Error(codes.NotFound, "not found"),
},
} {
s.Run(tc.desc, func() {
args := []string{
tc.idInTxHash,
}
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowInTxHashToCctx(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp types.QueryGetInTxHashToCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.InTxHashToCctx)
tc := tc
s.Require().Equal(nullify.Fill(&tc.obj),
nullify.Fill(&resp.InTxHashToCctx),
)
}
})
}
}
func (s *CliTestSuite) TestListInTxHashToCctx() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.InTxHashToCctxList
cctxCount := len(s.crosschainState.CrossChainTxs)
request := func(next []byte, offset, limit uint64, total bool) []string {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
if next == nil {
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset))
} else {
args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next))
}
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit))
if total {
args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal))
}
return args
}
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxHashToCctx(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxHashToCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().LessOrEqual(len(resp.InTxHashToCctx), step)
s.Require().Subset(nullify.Fill(objs),
nullify.Fill(resp.InTxHashToCctx),
)
}
})
s.Run("ByKey", func() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxHashToCctx(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxHashToCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().LessOrEqual(len(resp.InTxHashToCctx), step)
s.Require().Subset(nullify.Fill(objs),
nullify.Fill(resp.InTxHashToCctx),
)
next = resp.Pagination.NextKey
}
})
s.Run("Total", func() {
// #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxHashToCctx(), args)
s.Require().NoError(err)
var resp types.QueryAllInTxHashToCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
// saving CCTX also adds a new mapping
// #nosec G701 always in range
s.Require().Equal(len(objs)+cctxCount, int(resp.Pagination.Total))
s.Require().ElementsMatch(nullify.Fill(objs),
nullify.Fill(resp.InTxHashToCctx),
)
})
}
package querytests
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowLastBlockHeight() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.LastBlockHeightList
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
id string
args []string
err error
obj *types.LastBlockHeight
}{
{
desc: "found",
id: objs[0].Index,
args: common,
obj: objs[0],
},
{
desc: "not found",
id: "not_found",
args: common,
err: status.Error(codes.InvalidArgument, "not found"),
},
} {
tc := tc
s.Run(tc.desc, func() {
args := []string{tc.id}
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowLastBlockHeight(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp types.QueryGetLastBlockHeightResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.LastBlockHeight)
s.Require().Equal(tc.obj, resp.LastBlockHeight)
}
})
}
}
func (s *CliTestSuite) TestListLastBlockHeight() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.LastBlockHeightList
request := func(next []byte, offset, limit uint64, total bool) []string {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
if next == nil {
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset))
} else {
args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next))
}
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit))
if total {
args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal))
}
return args
}
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLastBlockHeight(), args)
s.Require().NoError(err)
var resp types.QueryAllLastBlockHeightResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Assert().Equal(objs[j], resp.LastBlockHeight[j-i])
}
}
})
s.Run("ByKey", func() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLastBlockHeight(), args)
s.Require().NoError(err)
var resp types.QueryAllLastBlockHeightResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
for j := i; j < len(objs) && j < i+step; j++ {
s.Assert().Equal(objs[j], resp.LastBlockHeight[j-i])
}
next = resp.Pagination.NextKey
}
})
s.Run("Total", func() {
// #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLastBlockHeight(), args)
s.Require().NoError(err)
var resp types.QueryAllLastBlockHeightResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
// #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.LastBlockHeight)
})
}
package querytests
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/testutil/nullify"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func (s *CliTestSuite) TestListOutTxTracker() {
ctx := s.network.Validators[0].ClientCtx
objs := s.crosschainState.OutTxTrackerList
request := func(next []byte, offset, limit uint64, total bool) []string {
args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
if next == nil {
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset))
} else {
args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next))
}
args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit))
if total {
args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal))
}
return args
}
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListOutTxTracker(), args)
s.Require().NoError(err)
var resp types.QueryAllOutTxTrackerResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().LessOrEqual(len(resp.OutTxTracker), step)
s.Require().Subset(nullify.Fill(objs),
nullify.Fill(resp.OutTxTracker),
)
}
})
s.Run("ByKey", func() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
// #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListOutTxTracker(), args)
s.Require().NoError(err)
var resp types.QueryAllOutTxTrackerResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().LessOrEqual(len(resp.OutTxTracker), step)
s.Require().Subset(
nullify.Fill(objs),
nullify.Fill(resp.OutTxTracker),
)
next = resp.Pagination.NextKey
}
})
s.Run("Total", func() {
// #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListOutTxTracker(), args)
s.Require().NoError(err)
var resp types.QueryAllOutTxTrackerResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
// #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().ElementsMatch(nullify.Fill(objs),
nullify.Fill(resp.OutTxTracker),
)
})
}
package querytests
import (
sdk "github.com/cosmos/cosmos-sdk/types"
ethcfg "github.com/evmos/ethermint/cmd/config"
"github.com/stretchr/testify/suite"
"github.com/zeta-chain/zetacore/app"
cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/testutil/network"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
type CliTestSuite struct {
suite.Suite
cfg network.Config
network *network.Network
crosschainState *types.GenesisState
observerState *observerTypes.GenesisState
}
func NewCLITestSuite(cfg network.Config) *CliTestSuite {
return &CliTestSuite{cfg: cfg}
}
func (s *CliTestSuite) Setconfig() {
config := sdk.GetConfig()
cmdcfg.SetBech32Prefixes(config)
ethcfg.SetBip44CoinType(config)
// Make sure the address is compatible with ethereum
config.SetAddressVerifier(app.VerifyAddressFormat)
config.Seal()
}
func (s *CliTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")
s.Setconfig()
minOBsDel, ok := sdk.NewIntFromString("100000000000000000000")
s.Require().True(ok)
s.cfg.StakingTokens = minOBsDel.Mul(sdk.NewInt(int64(10)))
s.cfg.BondedTokens = minOBsDel
observerList := []string{"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax",
"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2",
}
network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false)
s.crosschainState = network.AddCrosschainData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec)
s.observerState = network.AddObserverData(s.T(), s.cfg.GenesisState, s.cfg.Codec, nil)
net, err := network.New(s.T(), app.NodeDir, s.cfg)
s.Assert().NoError(err)
s.network = net
_, err = s.network.WaitForHeight(1)
s.Require().NoError(err)
}
func (s *CliTestSuite) TearDownSuite() {
s.T().Log("tearing down genesis test suite")
s.network.Cleanup()
}
package querytests
import (
"fmt"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowTSS() {
ctx := s.network.Validators[0].ClientCtx
obj := s.crosschainState.Tss
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
args []string
err error
obj *types.TSS
}{
{
desc: "get",
args: common,
obj: obj,
err: nil,
},
} {
tc := tc
s.Run(tc.desc, func() {
var args []string
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowTSS(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp types.QueryGetTSSResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.TSS)
s.Require().Equal(tc.obj, resp.TSS)
}
})
}
}
package crosschain
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/keeper"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
// InitGenesis initializes the crosschain module's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
// Params
k.SetParams(ctx, genState.Params)
// Set all the outTxTracker
for _, elem := range genState.OutTxTrackerList {
k.SetOutTxTracker(ctx, elem)
}
// Set all the inTxTracker
for _, elem := range genState.InTxTrackerList {
k.SetInTxTracker(ctx, elem)
}
// Set all the inTxHashToCctx
for _, elem := range genState.InTxHashToCctxList {
k.SetInTxHashToCctx(ctx, elem)
}
// Set all the gasPrice
for _, elem := range genState.GasPriceList {
if elem != nil {
k.SetGasPrice(ctx, *elem)
}
}
// Set all the chain nonces
for _, elem := range genState.ChainNoncesList {
if elem != nil {
k.SetChainNonces(ctx, *elem)
}
}
// Set all the last block heights
for _, elem := range genState.LastBlockHeightList {
if elem != nil {
k.SetLastBlockHeight(ctx, *elem)
}
}
// Set all the cross-chain txs
for _, elem := range genState.CrossChainTxs {
if elem != nil {
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, *elem)
}
}
if genState.Tss != nil {
k.SetTSS(ctx, *genState.Tss)
for _, chain := range common.DefaultChainsList() {
k.SetPendingNonces(ctx, types.PendingNonces{
NonceLow: 0,
NonceHigh: 0,
ChainId: chain.ChainId,
Tss: genState.Tss.TssPubkey,
})
}
for _, elem := range genState.TssHistory {
k.SetTSSHistory(ctx, elem)
}
}
}
// ExportGenesis returns the crosschain module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
var genesis types.GenesisState
genesis.Params = k.GetParams(ctx)
genesis.OutTxTrackerList = k.GetAllOutTxTracker(ctx)
genesis.InTxHashToCctxList = k.GetAllInTxHashToCctx(ctx)
genesis.InTxTrackerList = k.GetAllInTxTracker(ctx)
// Get tss
tss, found := k.GetTSS(ctx)
if found {
genesis.Tss = &tss
}
// Get all gas prices
gasPriceList := k.GetAllGasPrice(ctx)
for _, elem := range gasPriceList {
elem := elem
genesis.GasPriceList = append(genesis.GasPriceList, &elem)
}
// Get all chain nonces
chainNoncesList := k.GetAllChainNonces(ctx)
for _, elem := range chainNoncesList {
elem := elem
genesis.ChainNoncesList = append(genesis.ChainNoncesList, &elem)
}
// Get all last block heights
lastBlockHeightList := k.GetAllLastBlockHeight(ctx)
for _, elem := range lastBlockHeightList {
elem := elem
genesis.LastBlockHeightList = append(genesis.LastBlockHeightList, &elem)
}
// Get all send
sendList := k.GetAllCrossChainTx(ctx)
for _, elem := range sendList {
elem := elem
genesis.CrossChainTxs = append(genesis.CrossChainTxs, &elem)
}
genesis.TssHistory = k.GetAllTSS(ctx)
return &genesis
}
package keeper
import (
"fmt"
"time"
cosmoserrors "cosmossdk.io/errors"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)
const (
// RemainingFeesToStabilityPoolPercent is the percentage of remaining fees used to fund the gas stability pool
RemainingFeesToStabilityPoolPercent = 95
)
// IterateAndUpdateCctxGasPrice iterates through all cctx and updates the gas price if pending for too long
func (k Keeper) IterateAndUpdateCctxGasPrice(ctx sdk.Context) error {
// fetch the gas price increase flags or use default
gasPriceIncreaseFlags := observertypes.DefaultGasPriceIncreaseFlags
crosschainFlags, found := k.zetaObserverKeeper.GetCrosschainFlags(ctx)
if found && crosschainFlags.GasPriceIncreaseFlags != nil {
gasPriceIncreaseFlags = *crosschainFlags.GasPriceIncreaseFlags
}
// skip if haven't reached epoch end
if ctx.BlockHeight()%gasPriceIncreaseFlags.EpochLength != 0 {
return nil
}
// iterate all chains' pending cctx
chains := common.DefaultChainsList()
for _, chain := range chains {
res, err := k.CctxAllPending(sdk.UnwrapSDKContext(ctx), &types.QueryAllCctxPendingRequest{
ChainId: chain.ChainId,
})
if err != nil {
return err
}
// iterate through all pending cctx
for _, pendingCctx := range res.CrossChainTx {
if pendingCctx != nil {
_, _, err := k.CheckAndUpdateCctxGasPrice(ctx, *pendingCctx, gasPriceIncreaseFlags)
if err != nil {
return err
}
}
}
}
return nil
}
// CheckAndUpdateCctxGasPrice checks if the retry interval is reached and updates the gas price if so
// The function returns the gas price increase and the additional fees paid from the gas stability pool
func (k Keeper) CheckAndUpdateCctxGasPrice(
ctx sdk.Context,
cctx types.CrossChainTx,
flags observertypes.GasPriceIncreaseFlags,
) (math.Uint, math.Uint, error) {
// skip if gas price or gas limit is not set
if cctx.GetCurrentOutTxParam().OutboundTxGasPrice == "" || cctx.GetCurrentOutTxParam().OutboundTxGasLimit == 0 {
return math.ZeroUint(), math.ZeroUint(), nil
}
// skip if retry interval is not reached
lastUpdated := time.Unix(cctx.CctxStatus.LastUpdateTimestamp, 0)
if ctx.BlockTime().Before(lastUpdated.Add(flags.RetryInterval)) {
return math.ZeroUint(), math.ZeroUint(), nil
}
// compute gas price increase
chainID := cctx.GetCurrentOutTxParam().ReceiverChainId
medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID)
if !isFound {
return math.ZeroUint(), math.ZeroUint(), cosmoserrors.Wrap(
types.ErrUnableToGetGasPrice,
fmt.Sprintf("cannot get gas price for chain %d", chainID),
)
}
gasPriceIncrease := medianGasPrice.MulUint64(uint64(flags.GasPriceIncreasePercent)).QuoUint64(100)
// compute new gas price
currentGasPrice, err := cctx.GetCurrentOutTxParam().GetGasPrice()
if err != nil {
return math.ZeroUint(), math.ZeroUint(), err
}
newGasPrice := math.NewUint(currentGasPrice).Add(gasPriceIncrease)
// check limit -- use default limit if not set
gasPriceIncreaseMax := flags.GasPriceIncreaseMax
if gasPriceIncreaseMax == 0 {
gasPriceIncreaseMax = observertypes.DefaultGasPriceIncreaseFlags.GasPriceIncreaseMax
}
limit := medianGasPrice.MulUint64(uint64(gasPriceIncreaseMax)).QuoUint64(100)
if newGasPrice.GT(limit) {
return math.ZeroUint(), math.ZeroUint(), nil
}
// withdraw additional fees from the gas stability pool
gasLimit := math.NewUint(cctx.GetCurrentOutTxParam().OutboundTxGasLimit)
additionalFees := gasLimit.Mul(gasPriceIncrease)
if err := k.fungibleKeeper.WithdrawFromGasStabilityPool(ctx, chainID, additionalFees.BigInt()); err != nil {
return math.ZeroUint(), math.ZeroUint(), cosmoserrors.Wrap(
types.ErrNotEnoughFunds,
fmt.Sprintf("cannot withdraw %s from gas stability pool", additionalFees.String()),
)
}
// set new gas price and last update timestamp
cctx.GetCurrentOutTxParam().OutboundTxGasPrice = newGasPrice.String()
cctx.CctxStatus.LastUpdateTimestamp = ctx.BlockHeader().Time.Unix()
k.SetCrossChainTx(ctx, cctx)
return gasPriceIncrease, additionalFees, nil
}
package keeper
import (
"fmt"
cosmoserrors "cosmossdk.io/errors"
"cosmossdk.io/math"
"github.com/pkg/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// UpdateNonce sets the CCTX outbound nonce to the next nonce, and updates the nonce of blockchain state.
// It also updates the PendingNonces that is used to track the unfulfilled outbound txs.
func (k Keeper) UpdateNonce(ctx sdk.Context, receiveChainID int64, cctx *types.CrossChainTx) error {
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(receiveChainID)
if chain == nil {
return zetaObserverTypes.ErrSupportedChains
}
nonce, found := k.GetChainNonces(ctx, chain.ChainName.String())
if !found {
return cosmoserrors.Wrap(types.ErrCannotFindReceiverNonce, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX()))
}
// SET nonce
cctx.GetCurrentOutTxParam().OutboundTxTssNonce = nonce.Nonce
tss, found := k.GetTSS(ctx)
if !found {
return cosmoserrors.Wrap(types.ErrCannotFindTSSKeys, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX()))
}
p, found := k.GetPendingNonces(ctx, tss.TssPubkey, receiveChainID)
if !found {
return cosmoserrors.Wrap(types.ErrCannotFindPendingNonces, fmt.Sprintf("chain_id %d, nonce %d", receiveChainID, nonce.Nonce))
}
// #nosec G701 always in range
if p.NonceHigh != int64(nonce.Nonce) {
return cosmoserrors.Wrap(types.ErrNonceMismatch, fmt.Sprintf("chain_id %d, high nonce %d, current nonce %d", receiveChainID, p.NonceHigh, nonce.Nonce))
}
nonce.Nonce++
p.NonceHigh++
k.SetChainNonces(ctx, nonce)
k.SetPendingNonces(ctx, p)
return nil
}
// RefundAmountOnZetaChain refunds the amount of the cctx on ZetaChain in case of aborted cctx
// NOTE: GetCurrentOutTxParam should contain the last up to date cctx amount
func (k Keeper) RefundAmountOnZetaChain(ctx sdk.Context, cctx types.CrossChainTx, inputAmount math.Uint) error {
// preliminary checks
if cctx.InboundTxParams.CoinType != common.CoinType_ERC20 {
return errors.New("unsupported coin type for refund on ZetaChain")
}
if !common.IsEVMChain(cctx.InboundTxParams.SenderChainId) {
return errors.New("only EVM chains are supported for refund on ZetaChain")
}
sender := ethcommon.HexToAddress(cctx.InboundTxParams.Sender)
if sender == (ethcommon.Address{}) {
return errors.New("invalid sender address")
}
if inputAmount.IsNil() || inputAmount.IsZero() {
return errors.New("no amount to refund")
}
// get address of the zrc20
fc, found := k.fungibleKeeper.GetForeignCoinFromAsset(ctx, cctx.InboundTxParams.Asset, cctx.InboundTxParams.SenderChainId)
if !found {
return fmt.Errorf("asset %s zrc not found", cctx.InboundTxParams.Asset)
}
zrc20 := ethcommon.HexToAddress(fc.Zrc20ContractAddress)
if zrc20 == (ethcommon.Address{}) {
return fmt.Errorf("asset %s invalid zrc address", cctx.InboundTxParams.Asset)
}
// deposit the amount to the sender
if _, err := k.fungibleKeeper.DepositZRC20(ctx, zrc20, sender, inputAmount.BigInt()); err != nil {
return errors.New("failed to deposit zrc20 on ZetaChain" + err.Error())
}
return nil
}
// GetRevertGasLimit returns the gas limit for the revert transaction in a CCTX
// It returns 0 if there is no error but the gas limit can't be determined from the CCTX data
func (k Keeper) GetRevertGasLimit(ctx sdk.Context, cctx types.CrossChainTx) (uint64, error) {
if cctx.InboundTxParams == nil {
return 0, nil
}
if cctx.InboundTxParams.CoinType == common.CoinType_Gas {
// get the gas limit of the gas token
fc, found := k.fungibleKeeper.GetGasCoinForForeignCoin(ctx, cctx.InboundTxParams.SenderChainId)
if !found {
return 0, types.ErrForeignCoinNotFound
}
gasLimit, err := k.fungibleKeeper.QueryGasLimit(ctx, ethcommon.HexToAddress(fc.Zrc20ContractAddress))
if err != nil {
return 0, errors.Wrap(fungibletypes.ErrContractCall, err.Error())
}
return gasLimit.Uint64(), nil
} else if cctx.InboundTxParams.CoinType == common.CoinType_ERC20 {
// get the gas limit of the associated asset
fc, found := k.fungibleKeeper.GetForeignCoinFromAsset(ctx, cctx.InboundTxParams.Asset, cctx.InboundTxParams.SenderChainId)
if !found {
return 0, types.ErrForeignCoinNotFound
}
gasLimit, err := k.fungibleKeeper.QueryGasLimit(ctx, ethcommon.HexToAddress(fc.Zrc20ContractAddress))
if err != nil {
return 0, errors.Wrap(fungibletypes.ErrContractCall, err.Error())
}
return gasLimit.Uint64(), nil
}
return 0, nil
}
package keeper
import (
"strconv"
"github.com/zeta-chain/zetacore/common"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func EmitEventInboundFinalized(ctx sdk.Context, cctx *types.CrossChainTx) {
currentOutParam := cctx.GetCurrentOutTxParam()
err := ctx.EventManager().EmitTypedEvents(&types.EventInboundFinalized{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedInboundTx{}),
CctxIndex: cctx.Index,
Sender: cctx.InboundTxParams.Sender,
SenderChain: common.GetChainFromChainID(cctx.InboundTxParams.SenderChainId).ChainName.String(),
TxOrgin: cctx.InboundTxParams.TxOrigin,
Asset: cctx.InboundTxParams.Asset,
InTxHash: cctx.InboundTxParams.InboundTxObservedHash,
InBlockHeight: strconv.FormatUint(cctx.InboundTxParams.InboundTxObservedExternalHeight, 10),
Receiver: currentOutParam.Receiver,
ReceiverChain: common.GetChainFromChainID(currentOutParam.ReceiverChainId).ChainName.String(),
Amount: cctx.InboundTxParams.Amount.String(),
RelayedMessage: cctx.RelayedMessage,
NewStatus: cctx.CctxStatus.Status.String(),
StatusMessage: cctx.CctxStatus.StatusMessage,
})
if err != nil {
ctx.Logger().Error("Error emitting EventInboundFinalized :", err)
}
}
func EmitZRCWithdrawCreated(ctx sdk.Context, cctx types.CrossChainTx) {
err := ctx.EventManager().EmitTypedEvents(&types.EventZrcWithdrawCreated{
MsgTypeUrl: "/zetachain.zetacore.crosschain.internal.ZRCWithdrawCreated",
CctxIndex: cctx.Index,
Sender: cctx.InboundTxParams.Sender,
InTxHash: cctx.InboundTxParams.InboundTxObservedHash,
NewStatus: cctx.CctxStatus.Status.String(),
})
if err != nil {
ctx.Logger().Error("Error emitting ZRCWithdrawCreated :", err)
}
}
func EmitZetaWithdrawCreated(ctx sdk.Context, cctx types.CrossChainTx) {
err := ctx.EventManager().EmitTypedEvent(&types.EventZetaWithdrawCreated{
MsgTypeUrl: "/zetachain.zetacore.crosschain.internal.ZetaWithdrawCreated",
CctxIndex: cctx.Index,
Sender: cctx.InboundTxParams.Sender,
InTxHash: cctx.InboundTxParams.InboundTxObservedHash,
NewStatus: cctx.CctxStatus.Status.String(),
})
if err != nil {
ctx.Logger().Error("Error emitting ZetaWithdrawCreated :", err)
}
}
func EmitOutboundSuccess(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx, oldStatus string, newStatus string, cctx types.CrossChainTx) {
err := ctx.EventManager().EmitTypedEvents(&types.EventOutboundSuccess{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}),
CctxIndex: cctx.Index,
ValueReceived: msg.ValueReceived.String(),
OldStatus: oldStatus,
NewStatus: newStatus,
})
if err != nil {
ctx.Logger().Error("Error emitting MsgVoteOnObservedOutboundTx :", err)
}
}
func EmitOutboundFailure(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx, oldStatus string, newStatus string, cctx types.CrossChainTx) {
err := ctx.EventManager().EmitTypedEvents(&types.EventOutboundFailure{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}),
CctxIndex: cctx.Index,
ValueReceived: msg.ValueReceived.String(),
OldStatus: oldStatus,
NewStatus: newStatus,
})
if err != nil {
ctx.Logger().Error("Error emitting MsgVoteOnObservedOutboundTx :", err)
}
}
package keeper
import (
"encoding/hex"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/pkg/errors"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
)
// HandleEVMDeposit handles a deposit from an inbound tx
// returns (isContractReverted, err)
// (true, non-nil) means CallEVM() reverted
func (k Keeper) HandleEVMDeposit(
ctx sdk.Context,
cctx *types.CrossChainTx,
msg types.MsgVoteOnObservedInboundTx,
senderChain *common.Chain,
) (bool, error) {
to := ethcommon.HexToAddress(msg.Receiver)
var ethTxHash ethcommon.Hash
if len(ctx.TxBytes()) > 0 {
// add event for tendermint transaction hash format
hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash())
ethTxHash = ethcommon.BytesToHash(hash)
cctx.GetCurrentOutTxParam().OutboundTxHash = ethTxHash.String()
// #nosec G701 always positive
cctx.GetCurrentOutTxParam().OutboundTxObservedExternalHeight = uint64(ctx.BlockHeight())
}
if msg.CoinType == common.CoinType_Zeta {
// if coin type is Zeta, this is a deposit ZETA to zEVM cctx.
err := k.fungibleKeeper.DepositCoinZeta(ctx, to, msg.Amount.BigInt())
if err != nil {
return false, err
}
} else {
// cointype is Gas or ERC20; then it could be a ZRC20 deposit/depositAndCall cctx.
parsedAddress, data, err := parseAddressAndData(msg.Message)
if err != nil {
return false, errors.Wrap(types.ErrUnableToParseAddress, err.Error())
}
if parsedAddress != (ethcommon.Address{}) {
to = parsedAddress
}
from, err := senderChain.DecodeAddress(msg.Sender)
if err != nil {
return false, fmt.Errorf("HandleEVMDeposit: unable to decode address: %s", err.Error())
}
evmTxResponse, contractCall, err := k.fungibleKeeper.ZRC20DepositAndCallContract(
ctx,
from,
to,
msg.Amount.BigInt(),
senderChain,
data,
msg.CoinType,
msg.Asset,
)
if err != nil {
isContractReverted := false
// consider the contract as reverted if foreign coin liquidity cap is reached or calling a non-contract address
if (evmTxResponse != nil && evmTxResponse.Failed()) ||
errors.Is(err, fungibletypes.ErrForeignCoinCapReached) ||
errors.Is(err, fungibletypes.ErrCallNonContract) {
isContractReverted = true
}
return isContractReverted, err
}
// non-empty msg.Message means this is a contract call; therefore the logs should be processed.
// a withdrawal event in the logs could generate cctxs for outbound transactions.
if !evmTxResponse.Failed() && contractCall {
logs := evmtypes.LogsToEthereum(evmTxResponse.Logs)
if len(logs) > 0 {
ctx = ctx.WithValue("inCctxIndex", cctx.Index)
txOrigin := msg.TxOrigin
if txOrigin == "" {
txOrigin = msg.Sender
}
err = k.ProcessLogs(ctx, logs, to, txOrigin)
if err != nil {
// ProcessLogs should not error; error indicates exception, should abort
return false, errors.Wrap(types.ErrCannotProcessWithdrawal, err.Error())
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
sdk.NewAttribute("action", "DepositZRC20AndCallContract"),
sdk.NewAttribute("contract", to.String()),
sdk.NewAttribute("data", hex.EncodeToString(data)),
sdk.NewAttribute("cctxIndex", cctx.Index),
),
)
}
}
}
return false, nil
}
// parseAddressAndData parses the message string into an address and data
// message is hex encoded byte array
// [ contractAddress calldata ]
// [ 20B, variable]
func parseAddressAndData(message string) (ethcommon.Address, []byte, error) {
if len(message) == 0 {
return ethcommon.Address{}, nil, nil
}
data, err := hex.DecodeString(message)
if err != nil {
return ethcommon.Address{}, nil, fmt.Errorf("message should be a hex encoded string: " + err.Error())
}
if len(data) < 20 {
return ethcommon.Address{}, data, nil
}
address := ethcommon.BytesToAddress(data[:20])
data = data[20:]
return address, data, nil
}
package keeper
import (
"bytes"
"encoding/hex"
"fmt"
"math/big"
"strings"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
"github.com/btcsuite/btcutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
connectorzevm "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/connectorzevm.sol"
zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
"github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
var _ evmtypes.EvmHooks = Hooks{}
type Hooks struct {
k Keeper
}
func (k Keeper) Hooks() Hooks {
return Hooks{k}
}
// PostTxProcessing is a wrapper for calling the EVM PostTxProcessing hook on
// the module keeper
func (h Hooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error {
return h.k.PostTxProcessing(ctx, msg, receipt)
}
// PostTxProcessing implements EvmHooks.PostTxProcessing.
func (k Keeper) PostTxProcessing(
ctx sdk.Context,
msg core.Message,
receipt *ethtypes.Receipt,
) error {
abiStr := "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"}," +
"{\"internalType\":\"string\",\"name\":\"symbol_\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"chainid_\",\"type\":\"uint256\"},{\"internalType\":\"enumCoinType\",\"name\":\"coinType_\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit_\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"systemContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerIsNotFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GasFeeTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LowAllowance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LowBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroGasCoin\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroGasPrice\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"from\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedGasLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFlatFee\",\"type\":\"uint256\"}],\"name\":\"UpdatedProtocolFlatFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"systemContract\",\"type\":\"address\"}],\"name\":\"UpdatedSystemContract\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"to\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasfee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFlatFee\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CHAIN_ID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"COIN_TYPE\",\"outputs\":[{\"internalType\":\"enumCoinType\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FUNGIBLE_MODULE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PROTOCOL_FLAT_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SYSTEM_CONTRACT_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"}],\"name\":\"updateGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"protocolFlatFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFlatFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"updateSystemContractAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"to\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawGasFee\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"
inputData := msg.Data()
if len(inputData) >= 4 {
// Check if method exist in ABI
methodID := inputData[:4]
parsedABI, err := abi.JSON(strings.NewReader(abiStr))
if err != nil {
return err
}
for _, method := range parsedABI.Methods {
if bytes.Equal(methodID, method.ID) {
// Check if deactivated method
if method.Name == "increaseAllowance" || method.Name == "decreaseAllowance" {
return fmt.Errorf("%s not allowed", method.Name)
}
}
}
}
var emittingContract ethcommon.Address
if msg.To() != nil {
emittingContract = *msg.To()
}
return k.ProcessLogs(ctx, receipt.Logs, emittingContract, msg.From().Hex())
}
// ProcessLogs post-processes logs emitted by a zEVM contract; if the log contains Withdrawal event
// from registered ZRC20 contract, new CCTX will be created to trigger and track outbound
// transaction.
func (k Keeper) ProcessLogs(ctx sdk.Context, logs []*ethtypes.Log, emittingContract ethcommon.Address, txOrigin string) error {
system, found := k.fungibleKeeper.GetSystemContract(ctx)
if !found {
return fmt.Errorf("cannot find system contract")
}
connectorZEVMAddr := ethcommon.HexToAddress(system.ConnectorZevm)
if connectorZEVMAddr == (ethcommon.Address{}) {
return fmt.Errorf("connectorZEVM address is empty")
}
for _, log := range logs {
eventWithdrawal, err := k.ParseZRC20WithdrawalEvent(ctx, *log)
if err == nil {
if err := k.ProcessZRC20WithdrawalEvent(ctx, eventWithdrawal, emittingContract, txOrigin); err != nil {
return err
}
}
eZeta, err := ParseZetaSentEvent(*log, connectorZEVMAddr)
if err == nil {
if err := k.ProcessZetaSentEvent(ctx, eZeta, emittingContract, txOrigin); err != nil {
return err
}
}
}
return nil
}
// ProcessZRC20WithdrawalEvent creates a new CCTX to process the withdrawal event
// error indicates system error and non-recoverable; should abort
func (k Keeper) ProcessZRC20WithdrawalEvent(ctx sdk.Context, event *zrc20.ZRC20Withdrawal, emittingContract ethcommon.Address, txOrigin string) error {
if !k.zetaObserverKeeper.IsInboundEnabled(ctx) {
return types.ErrNotEnoughPermissions
}
ctx.Logger().Info("ZRC20 withdrawal to %s amount %d\n", hex.EncodeToString(event.To), event.Value)
tss, found := k.GetTSS(ctx)
if !found {
return errorsmod.Wrap(types.ErrCannotFindTSSKeys, "ProcessZRC20WithdrawalEvent: cannot be processed without TSS keys")
}
foreignCoin, found := k.fungibleKeeper.GetForeignCoins(ctx, event.Raw.Address.Hex())
if !found {
return fmt.Errorf("cannot find foreign coin with emittingContract address %s", event.Raw.Address.Hex())
}
receiverChain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(foreignCoin.ForeignChainId)
senderChain := common.ZetaChain()
toAddr, err := receiverChain.EncodeAddress(event.To)
if err != nil {
return fmt.Errorf("cannot encode address %s: %s", event.To, err.Error())
}
gasLimit, err := k.fungibleKeeper.QueryGasLimit(ctx, ethcommon.HexToAddress(foreignCoin.Zrc20ContractAddress))
if err != nil {
return fmt.Errorf("cannot query gas limit: %s", err.Error())
}
// gasLimit+uint64(event.Raw.Index) to generate different cctx for multiple events in the same tx.
msg := types.NewMsgVoteOnObservedInboundTx(
"",
emittingContract.Hex(),
senderChain.ChainId,
txOrigin,
toAddr,
foreignCoin.ForeignChainId,
math.NewUintFromBigInt(event.Value),
"",
event.Raw.TxHash.String(),
event.Raw.BlockNumber,
gasLimit.Uint64()+uint64(event.Raw.Index),
foreignCoin.CoinType,
foreignCoin.Asset,
)
sendHash := msg.Digest()
cctx := k.CreateNewCCTX(ctx, msg, sendHash, tss.TssPubkey, types.CctxStatus_PendingOutbound, &senderChain, receiverChain)
// Get gas price and amount
gasprice, found := k.GetGasPrice(ctx, receiverChain.ChainId)
if !found {
fmt.Printf("gasprice not found for %s\n", receiverChain)
return fmt.Errorf("gasprice not found for %s", receiverChain)
}
cctx.GetCurrentOutTxParam().OutboundTxGasPrice = fmt.Sprintf("%d", gasprice.Prices[gasprice.MedianIndex])
cctx.GetCurrentOutTxParam().Amount = cctx.InboundTxParams.Amount
EmitZRCWithdrawCreated(ctx, cctx)
return k.ProcessCCTX(ctx, cctx, receiverChain)
}
func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaConnectorZEVMZetaSent, emittingContract ethcommon.Address, txOrigin string) error {
if !k.zetaObserverKeeper.IsInboundEnabled(ctx) {
return types.ErrNotEnoughPermissions
}
ctx.Logger().Info(fmt.Sprintf(
"Zeta withdrawal to %s amount %d to chain with chainId %d",
hex.EncodeToString(event.DestinationAddress),
event.ZetaValueAndGas,
event.DestinationChainId,
))
tss, found := k.GetTSS(ctx)
if !found {
return errorsmod.Wrap(types.ErrCannotFindTSSKeys, "ProcessZetaSentEvent: cannot be processed without TSS keys")
}
if err := k.bankKeeper.BurnCoins(
ctx,
fungibletypes.ModuleName,
sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewIntFromBigInt(event.ZetaValueAndGas))),
); err != nil {
fmt.Printf("burn coins failed: %s\n", err.Error())
return fmt.Errorf("ProcessZetaSentEvent: failed to burn coins from fungible: %s", err.Error())
}
receiverChainID := event.DestinationChainId
receiverChain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(receiverChainID.Int64())
if receiverChain == nil {
return zetaObserverTypes.ErrSupportedChains
}
// Validation if we want to send ZETA to an external chain, but there is no ZETA token.
coreParams, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, receiverChain.ChainId)
if !found {
return types.ErrNotFoundCoreParams
}
if receiverChain.IsExternalChain() && coreParams.ZetaTokenContractAddress == "" {
return types.ErrUnableToSendCoinType
}
toAddr := "0x" + hex.EncodeToString(event.DestinationAddress)
senderChain := common.ZetaChain()
amount := math.NewUintFromBigInt(event.ZetaValueAndGas)
// Bump gasLimit by event index (which is very unlikely to be larger than 1000) to always have different ZetaSent events msgs.
msg := types.NewMsgVoteOnObservedInboundTx(
"",
emittingContract.Hex(),
senderChain.ChainId,
txOrigin, toAddr,
receiverChain.ChainId,
amount,
"",
event.Raw.TxHash.String(),
event.Raw.BlockNumber,
90000+uint64(event.Raw.Index),
common.CoinType_Zeta,
"",
)
sendHash := msg.Digest()
// Create the CCTX
cctx := k.CreateNewCCTX(ctx, msg, sendHash, tss.TssPubkey, types.CctxStatus_PendingOutbound, &senderChain, receiverChain)
if err := k.PayGasAndUpdateCctx(
ctx,
receiverChain.ChainId,
&cctx,
amount,
true,
); err != nil {
return fmt.Errorf("ProcessWithdrawalEvent: pay gas failed: %s", err.Error())
}
EmitZetaWithdrawCreated(ctx, cctx)
return k.ProcessCCTX(ctx, cctx, receiverChain)
}
func (k Keeper) ProcessCCTX(ctx sdk.Context, cctx types.CrossChainTx, receiverChain *common.Chain) error {
inCctxIndex, ok := ctx.Value("inCctxIndex").(string)
if ok {
cctx.InboundTxParams.InboundTxObservedHash = inCctxIndex
}
if err := k.UpdateNonce(ctx, receiverChain.ChainId, &cctx); err != nil {
return fmt.Errorf("ProcessWithdrawalEvent: update nonce failed: %s", err.Error())
}
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
ctx.Logger().Debug("ProcessCCTX successful \n")
return nil
}
// ParseZRC20WithdrawalEvent tries extracting Withdrawal event from registered ZRC20 contract;
// returns error if the log entry is not a Withdrawal event, or is not emitted from a
// registered ZRC20 contract
func (k Keeper) ParseZRC20WithdrawalEvent(ctx sdk.Context, log ethtypes.Log) (*zrc20.ZRC20Withdrawal, error) {
zrc20ZEVM, err := zrc20.NewZRC20Filterer(log.Address, bind.ContractFilterer(nil))
if err != nil {
return nil, err
}
event, err := zrc20ZEVM.ParseWithdrawal(log)
if err != nil {
return nil, err
}
coin, found := k.fungibleKeeper.GetForeignCoins(ctx, event.Raw.Address.Hex())
if !found {
return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: cannot find foreign coin with contract address %s", event.Raw.Address.Hex())
}
chainID := coin.ForeignChainId
if common.IsBitcoinChain(chainID) {
if event.Value.Cmp(big.NewInt(0)) <= 0 {
return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: invalid amount %s", event.Value.String())
}
btcChainParams, err := common.GetBTCChainParams(chainID)
if err != nil {
return nil, err
}
addr, err := btcutil.DecodeAddress(string(event.To), btcChainParams)
if err != nil {
return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: invalid address %s: %s", event.To, err)
}
_, ok := addr.(*btcutil.AddressWitnessPubKeyHash)
if !ok {
return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: invalid address %s (not P2WPKH address)", event.To)
}
}
return event, nil
}
func ParseZetaSentEvent(log ethtypes.Log, connectorZEVM ethcommon.Address) (*connectorzevm.ZetaConnectorZEVMZetaSent, error) {
zetaConnectorZEVM, err := connectorzevm.NewZetaConnectorZEVMFilterer(log.Address, bind.ContractFilterer(nil))
if err != nil {
return nil, err
}
event, err := zetaConnectorZEVM.ParseZetaSent(log)
if err != nil {
return nil, err
}
if event.Raw.Address != connectorZEVM {
return nil, fmt.Errorf("ParseZetaSentEvent: event address %s does not match connectorZEVM %s", event.Raw.Address.Hex(), connectorZEVM.Hex())
}
return event, nil
}
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
fungibleModuleTypes "github.com/zeta-chain/zetacore/x/fungible/types"
)
func (k Keeper) GetAllForeignCoins(ctx sdk.Context) ([]fungibleModuleTypes.ForeignCoins, error) {
chains := k.zetaObserverKeeper.GetParams(ctx).GetSupportedChains()
var fCoins []fungibleModuleTypes.ForeignCoins
for _, chain := range chains {
fCoins = append(fCoins, k.fungibleKeeper.GetAllForeignCoinsForChain(ctx, chain.ChainId)...)
}
return fCoins, nil
}
package keeper
import (
"errors"
"fmt"
"math/big"
cosmoserrors "cosmossdk.io/errors"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// PayGasAndUpdateCctx updates the outbound tx with the new amount after paying the gas fee
// **Caller should feed temporary ctx into this function**
func (k Keeper) PayGasAndUpdateCctx(
ctx sdk.Context,
chainID int64,
cctx *types.CrossChainTx,
inputAmount math.Uint,
noEthereumTxEvent bool,
) error {
// Dispatch to the correct function based on the coin type
switch cctx.InboundTxParams.CoinType {
case common.CoinType_Zeta:
return k.PayGasInZetaAndUpdateCctx(ctx, chainID, cctx, inputAmount, noEthereumTxEvent)
case common.CoinType_Gas:
return k.PayGasNativeAndUpdateCctx(ctx, chainID, cctx, inputAmount)
case common.CoinType_ERC20:
return k.PayGasInERC20AndUpdateCctx(ctx, chainID, cctx, inputAmount, noEthereumTxEvent)
default:
// can't pay gas with coin type
return fmt.Errorf("can't pay gas with coin type %s", cctx.InboundTxParams.CoinType.String())
}
}
// ChainGasParams returns the params to calculates the fees for gas for a chain
// tha gas address, the gas limit, gas price and protocol flat fee are returned
func (k Keeper) ChainGasParams(
ctx sdk.Context,
chainID int64,
) (gasZRC20 ethcommon.Address, gasLimit, gasPrice, protocolFee math.Uint, err error) {
gasZRC20, err = k.fungibleKeeper.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
if err != nil {
return gasZRC20, gasLimit, gasPrice, protocolFee, err
}
// get the gas limit
gasLimitQueried, err := k.fungibleKeeper.QueryGasLimit(ctx, gasZRC20)
if err != nil {
return gasZRC20, gasLimit, gasPrice, protocolFee, err
}
if gasLimitQueried == nil {
return gasZRC20, gasLimit, gasPrice, protocolFee, errors.New("gas limit is nil")
}
gasLimit = math.NewUintFromBigInt(gasLimitQueried)
// get the protocol flat fee
protocolFlatFeeQueried, err := k.fungibleKeeper.QueryProtocolFlatFee(ctx, gasZRC20)
if err != nil {
return gasZRC20, gasLimit, gasPrice, protocolFee, err
}
if protocolFlatFeeQueried == nil {
return gasZRC20, gasLimit, gasPrice, protocolFee, errors.New("protocol flat fee is nil")
}
protocolFee = math.NewUintFromBigInt(protocolFlatFeeQueried)
// get the gas price
gasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID)
if !isFound {
return gasZRC20, gasLimit, gasPrice, protocolFee, types.ErrUnableToGetGasPrice
}
return
}
// PayGasNativeAndUpdateCctx updates the outbound tx with the new amount subtracting the gas fee
// **Caller should feed temporary ctx into this function**
func (k Keeper) PayGasNativeAndUpdateCctx(
ctx sdk.Context,
chainID int64,
cctx *types.CrossChainTx,
inputAmount math.Uint,
) error {
// preliminary checks
if cctx.InboundTxParams.CoinType != common.CoinType_Gas {
return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in native gas with %s", cctx.InboundTxParams.CoinType.String())
}
if chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(chainID); chain == nil {
return zetaObserverTypes.ErrSupportedChains
}
// get gas params
_, gasLimit, gasPrice, protocolFlatFee, err := k.ChainGasParams(ctx, chainID)
if err != nil {
return cosmoserrors.Wrap(types.ErrCannotFindGasParams, err.Error())
}
// calculate the final gas fee
outTxGasFee := gasLimit.Mul(gasPrice).Add(protocolFlatFee)
// subtract the withdraw fee from the input amount
if outTxGasFee.GT(inputAmount) {
return cosmoserrors.Wrap(types.ErrNotEnoughGas, fmt.Sprintf("outTxGasFee(%s) more than available gas for tx (%s) | Identifiers : %s ",
outTxGasFee,
inputAmount,
cctx.LogIdentifierForCCTX()),
)
}
ctx.Logger().Info("Subtracting amount from inbound tx", "amount", inputAmount.String(), "fee", outTxGasFee.String())
newAmount := inputAmount.Sub(outTxGasFee)
// update cctx
cctx.GetCurrentOutTxParam().Amount = newAmount
cctx.GetCurrentOutTxParam().OutboundTxGasLimit = gasLimit.Uint64()
cctx.GetCurrentOutTxParam().OutboundTxGasPrice = gasPrice.String()
return nil
}
// PayGasInERC20AndUpdateCctx updates parameter cctx amount subtracting the gas fee
// the gas fee in ERC20 is calculated by swapping ERC20 -> Zeta -> Gas
// if the route is not available, the gas payment will fail
// **Caller should feed temporary ctx into this function**
func (k Keeper) PayGasInERC20AndUpdateCctx(
ctx sdk.Context,
chainID int64,
cctx *types.CrossChainTx,
inputAmount math.Uint,
noEthereumTxEvent bool,
) error {
// preliminary checks
if cctx.InboundTxParams.CoinType != common.CoinType_ERC20 {
return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in erc20 with %s", cctx.InboundTxParams.CoinType.String())
}
if chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(chainID); chain == nil {
return zetaObserverTypes.ErrSupportedChains
}
// get gas params
gasZRC20, gasLimit, gasPrice, protocolFlatFee, err := k.ChainGasParams(ctx, chainID)
if err != nil {
return cosmoserrors.Wrap(types.ErrCannotFindGasParams, err.Error())
}
outTxGasFee := gasLimit.Mul(gasPrice).Add(protocolFlatFee)
// get address of the zrc20
fc, found := k.fungibleKeeper.GetForeignCoinFromAsset(ctx, cctx.InboundTxParams.Asset, chainID)
if !found {
return cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "zrc20 from asset %s not found", cctx.InboundTxParams.Asset)
}
zrc20 := ethcommon.HexToAddress(fc.Zrc20ContractAddress)
if zrc20 == (ethcommon.Address{}) {
return cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "zrc20 from asset %s invalid address", cctx.InboundTxParams.Asset)
}
// get the necessary ERC20 amount for gas
feeInZRC20, err := k.fungibleKeeper.QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx, outTxGasFee.BigInt(), zrc20, gasZRC20)
if err != nil {
// NOTE: this is the first method that fails when a liquidity pool is not set for the gas ZRC20, so we return a specific error
return cosmoserrors.Wrap(types.ErrNoLiquidityPool, err.Error())
}
// subtract the withdraw fee from the input amount
if math.NewUintFromBigInt(feeInZRC20).GT(inputAmount) {
return cosmoserrors.Wrap(types.ErrNotEnoughGas, fmt.Sprintf("feeInZRC20(%s) more than available gas for tx (%s) | Identifiers : %s ",
feeInZRC20,
inputAmount,
cctx.LogIdentifierForCCTX()),
)
}
newAmount := inputAmount.Sub(math.NewUintFromBigInt(feeInZRC20))
// mint the amount of ERC20 to be burnt as gas fee
_, err = k.fungibleKeeper.DepositZRC20(ctx, zrc20, types.ModuleAddressEVM, feeInZRC20)
if err != nil {
return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
}
ctx.Logger().Info("Minted ERC20 for gas fee",
"zrc20", zrc20.Hex(),
"amount", feeInZRC20,
)
// approve the uniswapv2 router to spend the ERC20
routerAddress, err := k.fungibleKeeper.GetUniswapV2Router02Address(ctx)
if err != nil {
return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
}
err = k.fungibleKeeper.CallZRC20Approve(
ctx,
types.ModuleAddressEVM,
zrc20,
routerAddress,
feeInZRC20,
noEthereumTxEvent,
)
if err != nil {
return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
}
// swap the fee in ERC20 into gas passing through Zeta and burn the gas ZRC20
amounts, err := k.fungibleKeeper.CallUniswapV2RouterSwapExactTokensForTokens(
ctx,
types.ModuleAddressEVM,
types.ModuleAddressEVM,
feeInZRC20,
zrc20,
gasZRC20,
noEthereumTxEvent,
)
if err != nil {
return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
}
ctx.Logger().Info("CallUniswapV2RouterSwapExactTokensForTokens",
"zrc20AmountIn", amounts[0],
"gasAmountOut", amounts[2],
)
gasObtained := amounts[2]
// FIXME: investigate small mismatches between gasObtained and outTxGasFee
// https://github.com/zeta-chain/node/issues/1303
// check if the final gas received after swap matches the gas fee defined
// if not there might be issues with the pool liquidity and it is safer from an accounting perspective to return an error
if gasObtained.Cmp(outTxGasFee.BigInt()) == -1 {
return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) is lower than gas fee(%s)", gasObtained, outTxGasFee)
}
// burn the gas ZRC20
err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, gasObtained, noEthereumTxEvent)
if err != nil {
return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
}
ctx.Logger().Info("Burning gas ZRC20",
"zrc20", gasZRC20.Hex(),
"amount", gasObtained,
)
// update cctx
cctx.GetCurrentOutTxParam().Amount = newAmount
cctx.GetCurrentOutTxParam().OutboundTxGasLimit = gasLimit.Uint64()
cctx.GetCurrentOutTxParam().OutboundTxGasPrice = gasPrice.String()
return nil
}
// PayGasInZetaAndUpdateCctx updates parameter cctx with the gas price and gas fee for the outbound tx;
// it also makes a trade to fulfill the outbound tx gas fee in ZETA by swapping ZETA for some gas ZRC20 balances
// The gas ZRC20 balance is subsequently burned to account for the expense of TSS address gas fee payment in the outbound tx.
// zetaBurnt represents the amount of Zeta that has been burnt for the tx, the final amount for the tx is zetaBurnt - gasFee
// **Caller should feed temporary ctx into this function**
func (k Keeper) PayGasInZetaAndUpdateCctx(
ctx sdk.Context,
chainID int64,
cctx *types.CrossChainTx,
zetaBurnt math.Uint,
noEthereumTxEvent bool,
) error {
// preliminary checks
if cctx.InboundTxParams.CoinType != common.CoinType_Zeta {
return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in zeta with %s", cctx.InboundTxParams.CoinType.String())
}
if chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(chainID); chain == nil {
return zetaObserverTypes.ErrSupportedChains
}
gasZRC20, err := k.fungibleKeeper.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
if err != nil {
return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to get system contract gas coin")
}
// get the gas price
gasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID)
if !isFound {
return cosmoserrors.Wrap(types.ErrUnableToGetGasPrice, fmt.Sprintf(" chain %d | Identifiers : %s ",
chainID,
cctx.LogIdentifierForCCTX()),
)
}
gasPrice = gasPrice.MulUint64(2) // overpays gas price by 2x
// get the gas fee in gas token
gasLimit := sdk.NewUint(cctx.GetCurrentOutTxParam().OutboundTxGasLimit)
outTxGasFee := gasLimit.Mul(gasPrice)
// get the gas fee in Zeta using system uniswapv2 pool wzeta/gasZRC20 and adding the protocol fee
outTxGasFeeInZeta, err := k.fungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, outTxGasFee.BigInt(), gasZRC20)
if err != nil {
return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to QueryUniswapv2RouterGetAmountsIn")
}
feeInZeta := types.GetProtocolFee().Add(math.NewUintFromBigInt(outTxGasFeeInZeta))
// reduce the amount of the outbound tx
if feeInZeta.GT(zetaBurnt) {
return cosmoserrors.Wrap(types.ErrNotEnoughZetaBurnt, fmt.Sprintf("feeInZeta(%s) more than zetaBurnt (%s) | Identifiers : %s ",
feeInZeta,
zetaBurnt,
cctx.LogIdentifierForCCTX()),
)
}
ctx.Logger().Info("Subtracting amount from inbound tx",
"amount", zetaBurnt.String(),
"feeInZeta", feeInZeta.String(),
)
newAmount := zetaBurnt.Sub(feeInZeta)
// ** The following logic converts the outTxGasFeeInZeta into gasZRC20 and burns it **
// swap the outTxGasFeeInZeta portion of zeta to the real gas ZRC20 and burn it, in a temporary context.
{
coins := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewIntFromBigInt(feeInZeta.BigInt())))
err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins)
if err != nil {
return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to mint coins")
}
amounts, err := k.fungibleKeeper.CallUniswapV2RouterSwapExactETHForToken(
ctx,
types.ModuleAddressEVM,
types.ModuleAddressEVM,
outTxGasFeeInZeta,
gasZRC20,
noEthereumTxEvent,
)
if err != nil {
return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallUniswapv2RouterSwapExactETHForToken")
}
ctx.Logger().Info("gas fee", "outTxGasFee", outTxGasFee, "outTxGasFeeInZeta", outTxGasFeeInZeta)
ctx.Logger().Info("CallUniswapv2RouterSwapExactETHForToken",
"zetaAmountIn", amounts[0],
"zrc20AmountOut", amounts[1],
)
// FIXME: investigate small mismatches between amounts[1] and outTxGasFee
// https://github.com/zeta-chain/node/issues/1303
err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, amounts[1], noEthereumTxEvent)
if err != nil {
return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallZRC20Burn")
}
}
// Update the cctx
cctx.GetCurrentOutTxParam().OutboundTxGasPrice = gasPrice.String()
cctx.GetCurrentOutTxParam().Amount = newAmount
if cctx.ZetaFees.IsNil() {
cctx.ZetaFees = feeInZeta
} else {
cctx.ZetaFees = cctx.ZetaFees.Add(feeInZeta)
}
return nil
}
package keeper
import (
"context"
"github.com/btcsuite/btcutil"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
zcommon "github.com/zeta-chain/zetacore/common/cosmos"
"github.com/zeta-chain/zetacore/zetaclient/config"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) GetTssAddress(goCtx context.Context, req *types.QueryGetTssAddressRequest) (*types.QueryGetTssAddressResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
var tssPubKey string
if req.TssPubKey == "" {
tss, found := k.GetTSS(ctx)
if !found {
return nil, status.Error(codes.NotFound, "current tss not set")
}
tssPubKey = tss.TssPubkey
} else {
tssList := k.GetAllTSS(ctx)
for _, t := range tssList {
if t.TssPubkey == req.TssPubKey {
tssPubKey = t.TssPubkey
break
}
}
}
ethAddress, err := getTssAddrEVM(tssPubKey)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
btcAddress, err := getTssAddrBTC(tssPubKey)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryGetTssAddressResponse{
Eth: ethAddress.String(),
Btc: btcAddress,
}, nil
}
func getTssAddrEVM(tssPubkey string) (ethcommon.Address, error) {
var keyAddr ethcommon.Address
pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey)
if err != nil {
return keyAddr, err
}
//keyAddrBytes := pubk.EVMAddress().Bytes()
pubk.Bytes()
decompresspubkey, err := crypto.DecompressPubkey(pubk.Bytes())
if err != nil {
return keyAddr, err
}
keyAddr = crypto.PubkeyToAddress(*decompresspubkey)
return keyAddr, nil
}
func getTssAddrBTC(tssPubkey string) (string, error) {
addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tssPubkey)
if err != nil {
return "", err
}
return addrWPKH.EncodeAddress(), nil
}
func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string) (*btcutil.AddressWitnessPubKeyHash, error) {
pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey)
if err != nil {
return nil, err
}
addr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubk.Bytes()), config.BitconNetParams)
if err != nil {
return nil, err
}
return addr, nil
}
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) InTxHashToCctxAll(c context.Context, req *types.QueryAllInTxHashToCctxRequest) (*types.QueryAllInTxHashToCctxResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var inTxHashToCctxs []types.InTxHashToCctx
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
inTxHashToCctxStore := prefix.NewStore(store, types.KeyPrefix(types.InTxHashToCctxKeyPrefix))
pageRes, err := query.Paginate(inTxHashToCctxStore, req.Pagination, func(key []byte, value []byte) error {
var inTxHashToCctx types.InTxHashToCctx
if err := k.cdc.Unmarshal(value, &inTxHashToCctx); err != nil {
return err
}
inTxHashToCctxs = append(inTxHashToCctxs, inTxHashToCctx)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllInTxHashToCctxResponse{InTxHashToCctx: inTxHashToCctxs, Pagination: pageRes}, nil
}
func (k Keeper) InTxHashToCctx(c context.Context, req *types.QueryGetInTxHashToCctxRequest) (*types.QueryGetInTxHashToCctxResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetInTxHashToCctx(
ctx,
req.InTxHash,
)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetInTxHashToCctxResponse{InTxHashToCctx: val}, nil
}
// InTxHashToCctxData queries the data of all cctxs indexed by a in tx hash
func (k Keeper) InTxHashToCctxData(
c context.Context,
req *types.QueryInTxHashToCctxDataRequest,
) (*types.QueryInTxHashToCctxDataResponse, error) {
inTxHashToCctxRes, err := k.InTxHashToCctx(c, &types.QueryGetInTxHashToCctxRequest{InTxHash: req.InTxHash})
if err != nil {
return nil, err
}
cctxs := make([]types.CrossChainTx, len(inTxHashToCctxRes.InTxHashToCctx.CctxIndex))
ctx := sdk.UnwrapSDKContext(c)
for i, cctxIndex := range inTxHashToCctxRes.InTxHashToCctx.CctxIndex {
cctx, found := k.GetCrossChainTx(ctx, cctxIndex)
if !found {
// This is an internal error because the cctx should always exist from the index
return nil, status.Errorf(codes.Internal, "cctx indexed %s doesn't exist", cctxIndex)
}
cctxs[i] = cctx
}
return &types.QueryInTxHashToCctxDataResponse{CrossChainTxs: cctxs}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) InTxTrackerAllByChain(goCtx context.Context, request *types.QueryAllInTxTrackerByChainRequest) (*types.QueryAllInTxTrackerByChainResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
var inTxTrackers []types.InTxTracker
inTxTrackers, pageRes, err := k.GetAllInTxTrackerForChainPaginated(ctx, request.ChainId, request.Pagination)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllInTxTrackerByChainResponse{InTxTracker: inTxTrackers, Pagination: pageRes}, nil
}
func (k Keeper) InTxTrackerAll(goCtx context.Context, _ *types.QueryAllInTxTrackersRequest) (*types.QueryAllInTxTrackersResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
var inTxTrackers []types.InTxTracker
inTxTrackers = k.GetAllInTxTracker(ctx)
return &types.QueryAllInTxTrackersResponse{InTxTracker: inTxTrackers}, nil
}
package keeper
import (
"bytes"
"context"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"math"
"strings"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
ethtypes "github.com/ethereum/go-ethereum/core/types"
ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
abci "github.com/tendermint/tendermint/abci/types"
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
const (
NonEthTransactionType = "0x88"
)
func (k Keeper) ZEVMGetBlock(c context.Context, req *types.QueryZEVMGetBlockByNumberRequest) (*types.QueryZEVMGetBlockByNumberResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
rpcclient := types.ClientCtx.Client
if rpcclient == nil {
return nil, status.Error(codes.Internal, "rpc client is not initialized")
}
height := req.Height
if height >= math.MaxInt64 {
return nil, status.Error(codes.OutOfRange, "invalid height , the height is too large")
}
// #nosec G701 range checked
blockResults, err := GetTendermintBlockResultsByNumber(ctx, int64(req.Height))
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
// #nosec G701 range checked
block, err := GetTendermintBlockByNumber(ctx, int64(req.Height))
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
txDecoder := types.ClientCtx.TxConfig.TxDecoder()
transactionHashes := make([]string, 0)
for idx, txResult := range blockResults.TxsResults {
logs, err := GetEthLogsFromEvents(txResult.Events)
if err != nil || len(logs) == 0 {
continue
}
txBytes := block.Block.Txs[idx]
tx, err := txDecoder(txBytes)
if err != nil {
continue
}
if len(tx.GetMsgs()) == 0 { // should not happen; but just in case
continue
}
_, ok := tx.GetMsgs()[0].(*evmtypes.MsgEthereumTx)
if ok { // skip MsgEthereumTx; these txs are handled by ethermint JSON-RPC server
continue
}
transactionHashes = append(transactionHashes, fmt.Sprintf("0x%x", block.Block.Txs[idx].Hash()))
}
bloom, err := BlockBloom(blockResults)
if err != nil {
k.Logger(ctx).Debug("failed to query BlockBloom", "height", block.Block.Height, "error", err.Error())
}
return &types.QueryZEVMGetBlockByNumberResponse{
Number: fmt.Sprintf("0x%x", req.Height),
Transactions: transactionHashes,
LogsBloom: fmt.Sprintf("0x%x", bloom),
Hash: ethcommon.BytesToHash(block.Block.Hash()).Hex(),
ParentHash: ethcommon.BytesToHash(block.Block.LastBlockID.Hash).Hex(),
Uncles: []string{},
Sha3Uncles: ethtypes.EmptyUncleHash.Hex(),
Nonce: fmt.Sprintf("0x%x", ethtypes.BlockNonce{}),
StateRoot: ethcommon.BytesToHash(block.Block.AppHash.Bytes()).Hex(),
ExtraData: "0x",
Timestamp: hexutil.Uint64(block.Block.Time.Unix()).String(),
Miner: ethcommon.BytesToAddress(block.Block.ProposerAddress.Bytes()).Hex(),
MixHash: ethcommon.Hash{}.Hex(),
TransactionsRoot: ethcommon.BytesToHash(block.Block.DataHash).Hex(),
ReceiptsRoot: ethtypes.EmptyRootHash.Hex(),
}, nil
}
func (k Keeper) ZEVMGetTransactionReceipt(c context.Context, req *types.QueryZEVMGetTransactionReceiptRequest) (*types.QueryZEVMGetTransactionReceiptResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
rpcclient := types.ClientCtx.Client
if rpcclient == nil {
return nil, status.Error(codes.Internal, "rpc client is not initialized")
}
hash := NormalizeHash(req.Hash)
query := fmt.Sprintf("ethereum_tx.txHash='%s'", hash)
res, err := rpcclient.TxSearch(c, query, false, nil, nil, "asc")
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
if len(res.Txs) == 0 {
return nil, status.Error(codes.NotFound, "transaction not found")
}
txRaw := res.Txs[0]
block, err := GetTendermintBlockByNumber(ctx, txRaw.Height)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
blockHash := ethcommon.BytesToHash(block.BlockID.Hash.Bytes())
blockNumber := fmt.Sprintf("0x%x", txRaw.Height)
tx, err := types.ClientCtx.TxConfig.TxDecoder()(txRaw.Tx)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
msg0 := tx.GetMsgs()[0]
fromAddress := ethcommon.BytesToAddress(msg0.GetSigners()[0].Bytes())
status0 := "0x0"
if txRaw.TxResult.Code == 0 { // code 0 means success for cosmos tx; ref https://docs.cosmos.network/main/core/baseapp#delivertx
status0 = "0x1" // 1 = success in ethereum;
}
hash = ethcommon.BytesToHash(txRaw.Hash.Bytes()).Hex()
logs, err := GetEthLogsFromEvents(txRaw.TxResult.Events)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
for _, log := range logs {
log.TransactionHash = hash
}
return &types.QueryZEVMGetTransactionReceiptResponse{
BlockHash: blockHash.Hex(),
BlockNumber: blockNumber,
ContractAddress: "", // this is the contract created by the transaction, if any
CumulativeGasUsed: "0x0",
From: fromAddress.Hex(),
GasUsed: fmt.Sprintf("0x%x", txRaw.TxResult.GasUsed),
LogsBloom: "", //FIXME: add proper bloom filter
Status: status0,
To: "",
TransactionHash: hash,
TransactionIndex: fmt.Sprintf("0x%x", txRaw.Index), // FIXME: does this make sense?
Logs: logs,
}, nil
}
func (k Keeper) ZEVMGetTransaction(c context.Context, req *types.QueryZEVMGetTransactionRequest) (*types.QueryZEVMGetTransactionResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
rpcclient := types.ClientCtx.Client
if rpcclient == nil {
return nil, status.Error(codes.Internal, "rpc client is not initialized")
}
hash := NormalizeHash(req.Hash)
query := fmt.Sprintf("ethereum_tx.txHash='%s'", hash)
res, err := rpcclient.TxSearch(c, query, false, nil, nil, "asc")
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
if len(res.Txs) == 0 {
return nil, status.Error(codes.NotFound, "transaction not found")
}
txRaw := res.Txs[0]
block, err := GetTendermintBlockByNumber(ctx, txRaw.Height)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
tx, err := types.ClientCtx.TxConfig.TxDecoder()(txRaw.Tx)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
if len(tx.GetMsgs()) == 0 { // should not happen, just in case
return nil, status.Error(codes.Internal, "transaction has no messages")
}
msg0 := tx.GetMsgs()[0]
fromAddress := ethcommon.BytesToAddress(msg0.GetSigners()[0].Bytes())
chainID, err := ethermint.ParseChainID(ctx.ChainID())
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
var blockNumber string
hash = ethcommon.BytesToHash(txRaw.Hash.Bytes()).Hex()
blockNumber = fmt.Sprintf("0x%x", txRaw.Height)
blockHash := ethcommon.BytesToHash(block.BlockID.Hash.Bytes())
return &types.QueryZEVMGetTransactionResponse{
BlockHash: blockHash.Hex(),
BlockNumber: blockNumber,
From: fromAddress.Hex(), // FIXME: this should be the EOA on external chain?
Gas: fmt.Sprintf("0x%x", txRaw.TxResult.GasWanted),
GasPrice: "",
Hash: hash, // Note: This is the cosmos tx hash, in ethereum format (0x prefixed)
Input: "",
Nonce: "0",
To: "",
TransactionIndex: "0",
Value: "0",
Type: NonEthTransactionType,
AccessList: nil,
ChainId: chainID.String(),
V: "",
R: "",
S: "",
}, nil
}
func GetTendermintBlockByNumber(ctx sdk.Context, blockNum int64) (*tmrpctypes.ResultBlock, error) {
rpcclient := types.ClientCtx.Client
if rpcclient == nil {
return nil, fmt.Errorf("rpc client is not initialized")
}
height := blockNum
if height <= 0 {
height = ctx.BlockHeight()
}
resBlock, err := rpcclient.Block(sdk.WrapSDKContext(ctx), &height)
if err != nil {
return nil, fmt.Errorf("failed to get block by height %d: %w", height, err)
}
if resBlock.Block == nil {
return nil, nil
}
return resBlock, nil
}
func GetTendermintBlockResultsByNumber(ctx sdk.Context, blockNum int64) (*tmrpctypes.ResultBlockResults, error) {
rpcclient := types.ClientCtx.Client
if rpcclient == nil {
return nil, fmt.Errorf("rpc client is not initialized")
}
height := blockNum
if height <= 0 {
height = ctx.BlockHeight()
}
resBlock, err := rpcclient.BlockResults(sdk.WrapSDKContext(ctx), &height)
if err != nil {
return nil, fmt.Errorf("failed to get block by height %d: %w", height, err)
}
if resBlock == nil {
return nil, nil
}
return resBlock, nil
}
func GetEthLogsFromEvents(events []abci.Event) ([]*types.Log, error) {
logs := make([]*types.Log, 0)
for _, event := range events {
if event.Type == evmtypes.EventTypeTxLog {
for _, attr := range event.Attributes {
if !bytes.Equal(attr.Key, []byte(evmtypes.AttributeKeyTxLog)) {
continue
}
var log types.Log
err := json.Unmarshal(attr.Value, &log)
if err != nil {
return nil, err
}
data, err := base64.StdEncoding.DecodeString(log.Data)
if err == nil {
log.Data = "0x" + hex.EncodeToString(data)
}
logs = append(logs, &log)
}
}
}
return logs, nil
}
var bAttributeKeyEthereumBloom = []byte(evmtypes.AttributeKeyEthereumBloom)
// BlockBloom query block bloom filter from block results
// FIXME: does this work?
func BlockBloom(blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error) {
for _, event := range blockRes.EndBlockEvents {
if event.Type != evmtypes.EventTypeBlockBloom {
continue
}
for _, attr := range event.Attributes {
if bytes.Equal(attr.Key, bAttributeKeyEthereumBloom) {
return ethtypes.BytesToBloom(attr.Value), nil
}
}
}
return ethtypes.Bloom{}, errors.New("block bloom event is not found")
}
// convert an eth hash (0x prefixed hex) or a cosmos hash (no 0x prefix, uppercase hex)
// into a cosmos hash
func NormalizeHash(hashEthOrCosmos string) string {
if len(hashEthOrCosmos) == 66 && hashEthOrCosmos[:2] == "0x" { // eth format
return strings.ToUpper(hashEthOrCosmos[2:])
}
return hashEthOrCosmos
}
package keeper
import (
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
// SetInTxHashToCctx set a specific inTxHashToCctx in the store from its index
func (k Keeper) SetInTxHashToCctx(ctx sdk.Context, inTxHashToCctx types.InTxHashToCctx) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxHashToCctxKeyPrefix))
b := k.cdc.MustMarshal(&inTxHashToCctx)
store.Set(types.InTxHashToCctxKey(
inTxHashToCctx.InTxHash,
), b)
}
// GetInTxHashToCctx returns a inTxHashToCctx from its index
func (k Keeper) GetInTxHashToCctx(
ctx sdk.Context,
inTxHash string,
) (val types.InTxHashToCctx, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxHashToCctxKeyPrefix))
b := store.Get(types.InTxHashToCctxKey(
inTxHash,
))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveInTxHashToCctx removes a inTxHashToCctx from the store
func (k Keeper) RemoveInTxHashToCctx(
ctx sdk.Context,
inTxHash string,
) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxHashToCctxKeyPrefix))
store.Delete(types.InTxHashToCctxKey(
inTxHash,
))
}
// GetAllInTxHashToCctx returns all inTxHashToCctx
func (k Keeper) GetAllInTxHashToCctx(ctx sdk.Context) (list []types.InTxHashToCctx) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxHashToCctxKeyPrefix))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.InTxHashToCctx
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
package keeper
import (
"fmt"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func getInTrackerKey(chainID int64, txHash string) string {
return fmt.Sprintf("%d-%s", chainID, txHash)
}
// SetInTxTracker set a specific InTxTracker in the store from its index
func (k Keeper) SetInTxTracker(ctx sdk.Context, InTxTracker types.InTxTracker) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxTrackerKeyPrefix))
b := k.cdc.MustMarshal(&InTxTracker)
key := types.KeyPrefix(getInTrackerKey(InTxTracker.ChainId, InTxTracker.TxHash))
store.Set(key, b)
}
// GetInTxTracker returns a InTxTracker from its index
func (k Keeper) GetInTxTracker(ctx sdk.Context, chainID int64, txHash string) (val types.InTxTracker, found bool) {
key := getInTrackerKey(chainID, txHash)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxTrackerKeyPrefix))
b := store.Get(types.KeyPrefix(key))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) RemoveInTxTrackerIfExists(ctx sdk.Context, chainID int64, txHash string) {
key := getInTrackerKey(chainID, txHash)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxTrackerKeyPrefix))
if store.Has(types.KeyPrefix(key)) {
store.Delete(types.KeyPrefix(key))
}
}
func (k Keeper) GetAllInTxTracker(ctx sdk.Context) (list []types.InTxTracker) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxTrackerKeyPrefix))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.InTxTracker
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return list
}
func (k Keeper) GetAllInTxTrackerForChain(ctx sdk.Context, chainID int64) (list []types.InTxTracker) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxTrackerKeyPrefix))
iterator := sdk.KVStorePrefixIterator(store, []byte(fmt.Sprintf("%d-", chainID)))
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.InTxTracker
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return list
}
func (k Keeper) GetAllInTxTrackerForChainPaginated(ctx sdk.Context, chainID int64, pagination *query.PageRequest) (inTxTrackers []types.InTxTracker, pageRes *query.PageResponse, err error) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(fmt.Sprintf("%s", types.InTxTrackerKeyPrefix)))
chainStore := prefix.NewStore(store, types.KeyPrefix(fmt.Sprintf("%d-", chainID)))
pageRes, err = query.Paginate(chainStore, pagination, func(key []byte, value []byte) error {
var inTxTracker types.InTxTracker
if err := k.cdc.Unmarshal(value, &inTxTracker); err != nil {
return err
}
inTxTrackers = append(inTxTrackers, inTxTracker)
return nil
})
return
}
package keeper
import (
"fmt"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
type (
Keeper struct {
cdc codec.Codec
storeKey storetypes.StoreKey
memKey storetypes.StoreKey
StakingKeeper types.StakingKeeper
paramstore paramtypes.Subspace
authKeeper types.AccountKeeper
bankKeeper types.BankKeeper
zetaObserverKeeper types.ZetaObserverKeeper
fungibleKeeper types.FungibleKeeper
}
)
func NewKeeper(
cdc codec.Codec,
storeKey,
memKey storetypes.StoreKey,
stakingKeeper types.StakingKeeper, // custom
paramstore paramtypes.Subspace,
authKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
zetaObserverKeeper types.ZetaObserverKeeper,
fungibleKeeper types.FungibleKeeper,
) *Keeper {
// ensure governance module account is set
// FIXME: enable this check! (disabled for now to avoid unit test panic)
//if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil {
// panic(fmt.Sprintf("%s module account has not been set", types.ModuleName))
//}
return &Keeper{
cdc: cdc,
storeKey: storeKey,
memKey: memKey,
StakingKeeper: stakingKeeper,
paramstore: paramstore,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
zetaObserverKeeper: zetaObserverKeeper,
fungibleKeeper: fungibleKeeper,
}
}
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
func (k Keeper) GetAuthKeeper() types.AccountKeeper {
return k.authKeeper
}
func (k Keeper) GetBankKeeper() types.BankKeeper {
return k.bankKeeper
}
func (k Keeper) GetStakingKeeper() types.StakingKeeper {
return k.StakingKeeper
}
func (k Keeper) GetFungibleKeeper() types.FungibleKeeper {
return k.fungibleKeeper
}
func (k Keeper) GetObserverKeeper() types.ZetaObserverKeeper {
return k.zetaObserverKeeper
}
package keeper
import (
"context"
"fmt"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// SetChainNonces set a specific chainNonces in the store from its index
func (k Keeper) SetChainNonces(ctx sdk.Context, chainNonces types.ChainNonces) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey))
b := k.cdc.MustMarshal(&chainNonces)
store.Set(types.KeyPrefix(chainNonces.Index), b)
}
// GetChainNonces returns a chainNonces from its index
func (k Keeper) GetChainNonces(ctx sdk.Context, index string) (val types.ChainNonces, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey))
b := store.Get(types.KeyPrefix(index))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveChainNonces removes a chainNonces from the store
func (k Keeper) RemoveChainNonces(ctx sdk.Context, index string) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey))
store.Delete(types.KeyPrefix(index))
}
// GetAllChainNonces returns all chainNonces
func (k Keeper) GetAllChainNonces(ctx sdk.Context) (list []types.ChainNonces) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.ChainNonces
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
// Queries
func (k Keeper) ChainNoncesAll(c context.Context, req *types.QueryAllChainNoncesRequest) (*types.QueryAllChainNoncesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var chainNoncess []*types.ChainNonces
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
chainNoncesStore := prefix.NewStore(store, types.KeyPrefix(types.ChainNoncesKey))
pageRes, err := query.Paginate(chainNoncesStore, req.Pagination, func(key []byte, value []byte) error {
var chainNonces types.ChainNonces
if err := k.cdc.Unmarshal(value, &chainNonces); err != nil {
return err
}
chainNoncess = append(chainNoncess, &chainNonces)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllChainNoncesResponse{ChainNonces: chainNoncess, Pagination: pageRes}, nil
}
func (k Keeper) ChainNonces(c context.Context, req *types.QueryGetChainNoncesRequest) (*types.QueryGetChainNoncesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetChainNonces(ctx, req.Index)
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
return &types.QueryGetChainNoncesResponse{ChainNonces: &val}, nil
}
// MESSAGES
// Deprecated.
func (k msgServer) NonceVoter(goCtx context.Context, msg *types.MsgNonceVoter) (*types.MsgNonceVoterResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId)
if chain == nil {
return nil, observertypes.ErrSupportedChains
}
if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain); !ok {
return nil, observertypes.ErrNotAuthorizedPolicy
}
chainNonce, isFound := k.GetChainNonces(ctx, chain.ChainName.String())
if isFound {
isExisting := false
for _, signer := range chainNonce.Signers {
if signer == msg.Creator {
isExisting = true
}
}
if !isExisting {
chainNonce.Signers = append(chainNonce.Signers, msg.Creator)
}
chainNonce.Nonce = msg.Nonce
} else if !isFound {
chainNonce = types.ChainNonces{
Creator: msg.Creator,
Index: chain.ChainName.String(),
ChainId: chain.ChainId,
Nonce: msg.Nonce,
Signers: []string{msg.Creator},
}
} else {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("chainNonce vote msg does not match state: %v vs %v", msg, chainNonce))
}
//if hasSuperMajorityValidators(len(chainNonce.Signers), validators) {
// chainNonce.FinalizedHeight = uint64(ctx.BlockHeader().Height)
//}
k.SetChainNonces(ctx, chainNonce)
return &types.MsgNonceVoterResponse{}, nil
}
package keeper
import (
"context"
"fmt"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// SetCctxAndNonceToCctxAndInTxHashToCctx set a specific send in the store from its index
func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, send types.CrossChainTx) {
p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey))
store := prefix.NewStore(ctx.KVStore(k.storeKey), p)
b := k.cdc.MustMarshal(&send)
store.Set(types.KeyPrefix(send.Index), b)
// set mapping inTxHash -> cctxIndex
in, _ := k.GetInTxHashToCctx(ctx, send.InboundTxParams.InboundTxObservedHash)
in.InTxHash = send.InboundTxParams.InboundTxObservedHash
found := false
for _, cctxIndex := range in.CctxIndex {
if cctxIndex == send.Index {
found = true
break
}
}
if !found {
in.CctxIndex = append(in.CctxIndex, send.Index)
}
k.SetInTxHashToCctx(ctx, in)
tss, found := k.GetTSS(ctx)
if !found {
return
}
// set mapping nonce => cctxIndex
if send.CctxStatus.Status == types.CctxStatus_PendingOutbound || send.CctxStatus.Status == types.CctxStatus_PendingRevert {
k.SetNonceToCctx(ctx, types.NonceToCctx{
ChainId: send.GetCurrentOutTxParam().ReceiverChainId,
// #nosec G701 always in range
Nonce: int64(send.GetCurrentOutTxParam().OutboundTxTssNonce),
CctxIndex: send.Index,
Tss: tss.TssPubkey,
})
}
}
// SetCrossChainTx set a specific send in the store from its index
func (k Keeper) SetCrossChainTx(ctx sdk.Context, send types.CrossChainTx) {
p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey))
store := prefix.NewStore(ctx.KVStore(k.storeKey), p)
b := k.cdc.MustMarshal(&send)
store.Set(types.KeyPrefix(send.Index), b)
}
// GetCrossChainTx returns a send from its index
func (k Keeper) GetCrossChainTx(ctx sdk.Context, index string) (val types.CrossChainTx, found bool) {
p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey))
store := prefix.NewStore(ctx.KVStore(k.storeKey), p)
b := store.Get(types.KeyPrefix(index))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) GetAllCrossChainTx(ctx sdk.Context) (list []types.CrossChainTx) {
p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey))
store := prefix.NewStore(ctx.KVStore(k.storeKey), p)
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.CrossChainTx
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return list
}
// RemoveCrossChainTx removes a send from the store
func (k Keeper) RemoveCrossChainTx(ctx sdk.Context, index string) {
p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey))
store := prefix.NewStore(ctx.KVStore(k.storeKey), p)
store.Delete(types.KeyPrefix(index))
}
// Queries
func (k Keeper) CctxAll(c context.Context, req *types.QueryAllCctxRequest) (*types.QueryAllCctxResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var sends []*types.CrossChainTx
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
sendStore := prefix.NewStore(store, types.KeyPrefix(types.SendKey))
pageRes, err := query.Paginate(sendStore, req.Pagination, func(key []byte, value []byte) error {
var send types.CrossChainTx
if err := k.cdc.Unmarshal(value, &send); err != nil {
return err
}
sends = append(sends, &send)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllCctxResponse{CrossChainTx: sends, Pagination: pageRes}, nil
}
func (k Keeper) Cctx(c context.Context, req *types.QueryGetCctxRequest) (*types.QueryGetCctxResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetCrossChainTx(ctx, req.Index)
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
return &types.QueryGetCctxResponse{CrossChainTx: &val}, nil
}
func (k Keeper) CctxByNonce(c context.Context, req *types.QueryGetCctxByNonceRequest) (*types.QueryGetCctxResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
tss, found := k.GetTSS(ctx)
if !found {
return nil, status.Error(codes.Internal, "tss not found")
}
// #nosec G701 always in range
res, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainID, int64(req.Nonce))
if !found {
return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", req.Nonce, req.ChainID))
}
val, found := k.GetCrossChainTx(ctx, res.CctxIndex)
if !found {
return nil, status.Error(codes.Internal, fmt.Sprintf("cctx not found: index %s", res.CctxIndex))
}
return &types.QueryGetCctxResponse{CrossChainTx: &val}, nil
}
func (k Keeper) CctxAllPending(c context.Context, req *types.QueryAllCctxPendingRequest) (*types.QueryAllCctxPendingResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
tss, found := k.GetTSS(ctx)
if !found {
return nil, status.Error(codes.Internal, "tss not found")
}
p, found := k.GetPendingNonces(ctx, tss.TssPubkey, req.ChainId)
if !found {
return nil, status.Error(codes.Internal, "pending nonces not found")
}
sends := make([]*types.CrossChainTx, 0)
// now query the previous nonces up to 100 prior to find any pending cctx that we might have missed
// need this logic because a confirmation of higher nonce will automatically update the p.NonceLow
// therefore might mask some lower nonce cctx that is still pending.
startNonce := p.NonceLow - 100
if startNonce < 0 {
startNonce = 0
}
for i := startNonce; i < p.NonceLow; i++ {
res, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i)
if !found {
return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", i, req.ChainId))
}
send, found := k.GetCrossChainTx(ctx, res.CctxIndex)
if !found {
return nil, status.Error(codes.Internal, fmt.Sprintf("cctx not found: index %s", res.CctxIndex))
}
if send.CctxStatus.Status == types.CctxStatus_PendingOutbound || send.CctxStatus.Status == types.CctxStatus_PendingRevert {
sends = append(sends, &send)
}
}
// now query the pending nonces that we know are pending
for i := p.NonceLow; i < p.NonceHigh; i++ {
ntc, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i)
if !found {
return nil, status.Error(codes.Internal, "nonceToCctx not found")
}
cctx, found := k.GetCrossChainTx(ctx, ntc.CctxIndex)
if !found {
return nil, status.Error(codes.Internal, "cctxIndex not found")
}
sends = append(sends, &cctx)
}
return &types.QueryAllCctxPendingResponse{CrossChainTx: sends}, nil
}
func (k Keeper) CreateNewCCTX(ctx sdk.Context, msg *types.MsgVoteOnObservedInboundTx, index string, tssPubkey string, s types.CctxStatus, senderChain, receiverChain *common.Chain) types.CrossChainTx {
if msg.TxOrigin == "" {
msg.TxOrigin = msg.Sender
}
inboundParams := &types.InboundTxParams{
Sender: msg.Sender,
SenderChainId: senderChain.ChainId,
TxOrigin: msg.TxOrigin,
Asset: msg.Asset,
Amount: msg.Amount,
CoinType: msg.CoinType,
InboundTxObservedHash: msg.InTxHash,
InboundTxObservedExternalHeight: msg.InBlockHeight,
InboundTxFinalizedZetaHeight: 0,
InboundTxBallotIndex: index,
}
outBoundParams := &types.OutboundTxParams{
Receiver: msg.Receiver,
ReceiverChainId: receiverChain.ChainId,
OutboundTxHash: "",
OutboundTxTssNonce: 0,
OutboundTxGasLimit: msg.GasLimit,
OutboundTxGasPrice: "",
OutboundTxBallotIndex: "",
OutboundTxObservedExternalHeight: 0,
CoinType: msg.CoinType, // FIXME: is this correct?
Amount: sdk.NewUint(0),
TssPubkey: tssPubkey,
}
status := &types.Status{
Status: s,
StatusMessage: "",
LastUpdateTimestamp: ctx.BlockHeader().Time.Unix(),
}
newCctx := types.CrossChainTx{
Creator: msg.Creator,
Index: index,
ZetaFees: math.ZeroUint(),
RelayedMessage: msg.Message,
CctxStatus: status,
InboundTxParams: inboundParams,
OutboundTxParams: []*types.OutboundTxParams{outBoundParams},
}
return newCctx
}
package keeper
import (
"context"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerKeeper "github.com/zeta-chain/zetacore/x/observer/keeper"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// FIXME: use more specific error types & codes
// VoteOnObservedInboundTx casts a vote on an inbound transaction observed on a connected chain. If this
// is the first vote, a new ballot is created. When a threshold of votes is
// reached, the ballot is finalized. When a ballot is finalized, a new CCTX is
// created.
//
// If the receiver chain is ZetaChain, `HandleEVMDeposit` is called. If the
// tokens being deposited are ZETA, `MintZetaToEVMAccount` is called and the
// tokens are minted to the receiver account on ZetaChain. If the tokens being
// deposited are gas tokens or ERC20 of a connected chain, ZRC20's `deposit`
// method is called and the tokens are deposited to the receiver account on
// ZetaChain. If the message is not empty, system contract's `depositAndCall`
// method is also called and an omnichain contract on ZetaChain is executed.
// Omnichain contract address and arguments are passed as part of the message.
// If everything is successful, the CCTX status is changed to `OutboundMined`.
//
// If the receiver chain is a connected chain, the `FinalizeInbound` method is
// called to prepare the CCTX to be processed as an outbound transaction. To
// cover the outbound transaction fee, the required amount of tokens submitted
// with the CCTX are swapped using a Uniswap V2 contract instance on ZetaChain
// for the ZRC20 of the gas token of the receiver chain. The ZRC20 tokens are
// then burned. The nonce is updated. If everything is successful, the CCTX
// status is changed to `PendingOutbound`.
//
// ```mermaid
// stateDiagram-v2
//
// state evm_deposit_success <<choice>>
// state finalize_inbound <<choice>>
// state evm_deposit_error <<choice>>
// PendingInbound --> evm_deposit_success: Receiver is ZetaChain
// evm_deposit_success --> OutboundMined: EVM deposit success
// evm_deposit_success --> evm_deposit_error: EVM deposit error
// evm_deposit_error --> PendingRevert: Contract error
// evm_deposit_error --> Aborted: Internal error, invalid chain, gas, nonce
// PendingInbound --> finalize_inbound: Receiver is connected chain
// finalize_inbound --> Aborted: Finalize inbound error
// finalize_inbound --> PendingOutbound: Finalize inbound success
//
// ```
//
// Only observer validators are authorized to broadcast this message.
func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.MsgVoteOnObservedInboundTx) (*types.MsgVoteOnObservedInboundTxResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
observationType := observerTypes.ObservationType_InBoundTx
if !k.zetaObserverKeeper.IsInboundEnabled(ctx) {
return nil, types.ErrNotEnoughPermissions
}
// GetChainFromChainID makes sure we are getting only supported chains , if a chain support has been turned on using gov proposal, this function returns nil
observationChain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.SenderChainId)
if observationChain == nil {
return nil, sdkerrors.Wrap(types.ErrUnsupportedChain, fmt.Sprintf("ChainID %d, Observation %s", msg.SenderChainId, observationType.String()))
}
receiverChain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ReceiverChain)
if receiverChain == nil {
return nil, sdkerrors.Wrap(types.ErrUnsupportedChain, fmt.Sprintf("ChainID %d, Observation %s", msg.ReceiverChain, observationType.String()))
}
tssPub := ""
tss, tssFound := k.GetTSS(ctx)
if tssFound {
tssPub = tss.TssPubkey
}
// IsAuthorized does various checks against the list of observer mappers
if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, observationChain); !ok {
return nil, observerTypes.ErrNotAuthorizedPolicy
}
index := msg.Digest()
// Add votes and Set Ballot
// GetBallot checks against the supported chains list before querying for Ballot
ballot, isNew, err := k.zetaObserverKeeper.FindBallot(ctx, index, observationChain, observationType)
if err != nil {
return nil, err
}
if isNew {
observerKeeper.EmitEventBallotCreated(ctx, ballot, msg.InTxHash, observationChain.String())
}
// AddVoteToBallot adds a vote and sets the ballot
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_SuccessObservation)
if err != nil {
return nil, err
}
_, isFinalized := k.zetaObserverKeeper.CheckIfFinalizingVote(ctx, ballot)
if !isFinalized {
// Return nil here to add vote to ballot and commit state
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
// Validation if we want to send ZETA to external chain, but there is no ZETA token.
if receiverChain.IsExternalChain() {
coreParams, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, receiverChain.ChainId)
if !found {
return nil, types.ErrNotFoundCoreParams
}
if coreParams.ZetaTokenContractAddress == "" && msg.CoinType == common.CoinType_Zeta {
return nil, types.ErrUnableToSendCoinType
}
}
// ******************************************************************************
// below only happens when ballot is finalized: exactly when threshold vote is in
// ******************************************************************************
// Inbound Ballot has been finalized , Create CCTX
cctx := k.CreateNewCCTX(ctx, msg, index, tssPub, types.CctxStatus_PendingInbound, observationChain, receiverChain)
defer func() {
EmitEventInboundFinalized(ctx, &cctx)
// #nosec G701 always positive
cctx.InboundTxParams.InboundTxFinalizedZetaHeight = uint64(ctx.BlockHeight())
k.RemoveInTxTrackerIfExists(ctx, cctx.InboundTxParams.SenderChainId, cctx.InboundTxParams.InboundTxObservedHash)
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
}()
// FinalizeInbound updates CCTX Prices and Nonce
// Aborts is any of the updates fail
if receiverChain.IsZetaChain() {
tmpCtx, commit := ctx.CacheContext()
isContractReverted, err := k.HandleEVMDeposit(tmpCtx, &cctx, *msg, observationChain)
if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error())
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
} else if err != nil && isContractReverted { // contract call reverted; should refund
revertMessage := err.Error()
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(cctx.InboundTxParams.SenderChainId)
if chain == nil {
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "invalid sender chain")
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
gasLimit, err := k.GetRevertGasLimit(ctx, cctx)
if err != nil {
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "can't get revert tx gas limit"+err.Error())
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
if gasLimit == 0 {
// use same gas limit of outbound as a fallback -- should not happen
gasLimit = msg.GasLimit
}
// create new OutboundTxParams for the revert
revertTxParams := &types.OutboundTxParams{
Receiver: cctx.InboundTxParams.Sender,
ReceiverChainId: cctx.InboundTxParams.SenderChainId,
Amount: cctx.InboundTxParams.Amount,
CoinType: cctx.InboundTxParams.CoinType,
OutboundTxGasLimit: gasLimit,
}
cctx.OutboundTxParams = append(cctx.OutboundTxParams, revertTxParams)
// we create a new cached context, and we don't commit the previous one with EVM deposit
tmpCtx, commit := ctx.CacheContext()
err = func() error {
err := k.PayGasAndUpdateCctx(
tmpCtx,
chain.ChainId,
&cctx,
cctx.InboundTxParams.Amount,
false,
)
if err != nil {
return err
}
err = k.UpdateNonce(tmpCtx, chain.ChainId, &cctx)
if err != nil {
return err
}
return nil
}()
if err != nil {
// do not commit anything here as the CCTX should be aborted
// gas payment for erc20 type might fail because no liquidity pool is defined to swap the zrc20 token into the gas token
// in this gas we should refund the sender on ZetaChain
if cctx.InboundTxParams.CoinType == common.CoinType_ERC20 {
if err := k.RefundAmountOnZetaChain(ctx, cctx, cctx.InboundTxParams.Amount); err != nil {
// log the error
k.Logger(ctx).Error("failed to refund amount of aborted cctx on ZetaChain",
"error", err,
"sender", cctx.InboundTxParams.Sender,
"amount", cctx.InboundTxParams.Amount.String(),
)
}
}
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error())
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
commit()
cctx.CctxStatus.ChangeStatus(types.CctxStatus_PendingRevert, revertMessage)
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
} else { // successful HandleEVMDeposit;
commit()
cctx.CctxStatus.ChangeStatus(types.CctxStatus_OutboundMined, "Remote omnichain contract call completed")
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
} else { // Cross Chain SWAP
tmpCtx, commit := ctx.CacheContext()
err = func() error {
err := k.PayGasAndUpdateCctx(
tmpCtx,
receiverChain.ChainId,
&cctx,
cctx.InboundTxParams.Amount,
false,
)
if err != nil {
return err
}
err = k.UpdateNonce(tmpCtx, receiverChain.ChainId, &cctx)
if err != nil {
return err
}
return nil
}()
if err != nil {
// do not commit anything here as the CCTX should be aborted
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error())
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
commit()
cctx.CctxStatus.ChangeStatus(types.CctxStatus_PendingOutbound, "")
k.RemoveInTxTrackerIfExists(ctx, cctx.InboundTxParams.SenderChainId, cctx.InboundTxParams.InboundTxObservedHash)
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
}
package keeper
import (
"context"
"errors"
"fmt"
"math/big"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerKeeper "github.com/zeta-chain/zetacore/x/observer/keeper"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// VoteOnObservedOutboundTx casts a vote on an outbound transaction observed on a connected chain (after
// it has been broadcasted to and finalized on a connected chain). If this is
// the first vote, a new ballot is created. When a threshold of votes is
// reached, the ballot is finalized. When a ballot is finalized, the outbound
// transaction is processed.
//
// If the observation is successful, the difference between zeta burned
// and minted is minted by the bank module and deposited into the module
// account.
//
// If the observation is unsuccessful, the logic depends on the previous
// status.
//
// If the previous status was `PendingOutbound`, a new revert transaction is
// created. To cover the revert transaction fee, the required amount of tokens
// submitted with the CCTX are swapped using a Uniswap V2 contract instance on
// ZetaChain for the ZRC20 of the gas token of the receiver chain. The ZRC20
// tokens are then
// burned. The nonce is updated. If everything is successful, the CCTX status is
// changed to `PendingRevert`.
//
// If the previous status was `PendingRevert`, the CCTX is aborted.
//
// ```mermaid
// stateDiagram-v2
//
// state observation <<choice>>
// state success_old_status <<choice>>
// state fail_old_status <<choice>>
// PendingOutbound --> observation: Finalize outbound
// observation --> success_old_status: Observation succeeded
// success_old_status --> Reverted: Old status is PendingRevert
// success_old_status --> OutboundMined: Old status is PendingOutbound
// observation --> fail_old_status: Observation failed
// fail_old_status --> PendingRevert: Old status is PendingOutbound
// fail_old_status --> Aborted: Old status is PendingRevert
// PendingOutbound --> Aborted: Finalize outbound error
//
// ```
//
// Only observer validators are authorized to broadcast this message.
func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.MsgVoteOnObservedOutboundTx) (*types.MsgVoteOnObservedOutboundTxResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
observationType := observerTypes.ObservationType_OutBoundTx
// Observer Chain already checked then inbound is created
/* EDGE CASE : Params updated in during the finalization process
i.e Inbound has been finalized but outbound is still pending
*/
observationChain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.OutTxChain)
if observationChain == nil {
return nil, observerTypes.ErrSupportedChains
}
err := observerTypes.CheckReceiveStatus(msg.Status)
if err != nil {
return nil, err
}
//Check is msg.Creator is authorized to vote
if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, observationChain); !ok {
return nil, observerTypes.ErrNotAuthorizedPolicy
}
// Check if CCTX exists
cctx, found := k.GetCrossChainTx(ctx, msg.CctxHash)
if !found {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("CCTX %s does not exist", msg.CctxHash))
}
if cctx.GetCurrentOutTxParam().OutboundTxTssNonce != msg.OutTxTssNonce {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("OutTxTssNonce %d does not match CCTX OutTxTssNonce %d", msg.OutTxTssNonce, cctx.GetCurrentOutTxParam().OutboundTxTssNonce))
}
ballotIndex := msg.Digest()
// Add votes and Set Ballot
ballot, isNew, err := k.zetaObserverKeeper.FindBallot(ctx, ballotIndex, observationChain, observationType)
if err != nil {
return nil, err
}
if isNew {
observerKeeper.EmitEventBallotCreated(ctx, ballot, msg.ObservedOutTxHash, observationChain.String())
// Set this the first time when the ballot is created
// The ballot might change if there are more votes in a different outbound ballot for this cctx hash
cctx.GetCurrentOutTxParam().OutboundTxBallotIndex = ballotIndex
//k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
}
// AddVoteToBallot adds a vote and sets the ballot
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.ConvertReceiveStatusToVoteType(msg.Status))
if err != nil {
return nil, err
}
ballot, isFinalized := k.zetaObserverKeeper.CheckIfFinalizingVote(ctx, ballot)
if !isFinalized {
// Return nil here to add vote to ballot and commit state
return &types.MsgVoteOnObservedOutboundTxResponse{}, nil
}
if ballot.BallotStatus != observerTypes.BallotStatus_BallotFinalized_FailureObservation {
if !msg.ValueReceived.Equal(cctx.GetCurrentOutTxParam().Amount) {
log.Error().Msgf("VoteOnObservedOutboundTx: Mint mismatch: %s value received vs %s cctx amount",
msg.ValueReceived,
cctx.GetCurrentOutTxParam().Amount)
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("ValueReceived %s does not match sent value %s", msg.ValueReceived, cctx.GetCurrentOutTxParam().Amount))
}
}
// Update CCTX values
cctx.GetCurrentOutTxParam().OutboundTxHash = msg.ObservedOutTxHash
cctx.GetCurrentOutTxParam().OutboundTxGasUsed = msg.ObservedOutTxGasUsed
cctx.GetCurrentOutTxParam().OutboundTxEffectiveGasPrice = msg.ObservedOutTxEffectiveGasPrice
cctx.GetCurrentOutTxParam().OutboundTxEffectiveGasLimit = msg.ObservedOutTxEffectiveGasLimit
cctx.CctxStatus.LastUpdateTimestamp = ctx.BlockHeader().Time.Unix()
// Fund the gas stability pool with the remaining funds
if err := k.FundGasStabilityPoolFromRemainingFees(ctx, *cctx.GetCurrentOutTxParam(), msg.OutTxChain); err != nil {
log.Error().Msgf(
"VoteOnObservedOutboundTx: CCTX: %s Can't fund the gas stability pool with remaining fees %s", cctx.Index, err.Error(),
)
}
tss, _ := k.GetTSS(ctx)
// FinalizeOutbound sets final status for a successful vote
// FinalizeOutbound updates CCTX Prices and Nonce for a revert
tmpCtx, commit := ctx.CacheContext()
err = func() error { //err = FinalizeOutbound(k, ctx, &cctx, msg, ballot.BallotStatus)
cctx.GetCurrentOutTxParam().OutboundTxObservedExternalHeight = msg.ObservedOutTxBlockHeight
oldStatus := cctx.CctxStatus.Status
switch ballot.BallotStatus {
case observerTypes.BallotStatus_BallotFinalized_SuccessObservation:
switch oldStatus {
case types.CctxStatus_PendingRevert:
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Reverted, "")
case types.CctxStatus_PendingOutbound:
cctx.CctxStatus.ChangeStatus(types.CctxStatus_OutboundMined, "")
}
newStatus := cctx.CctxStatus.Status.String()
EmitOutboundSuccess(tmpCtx, msg, oldStatus.String(), newStatus, cctx)
case observerTypes.BallotStatus_BallotFinalized_FailureObservation:
if msg.CoinType == common.CoinType_Cmd || cctx.InboundTxParams.SenderChainId == common.ZetaChain().ChainId {
// if the cctx is of coin type cmd or the sender chain is zeta chain, then we do not revert, the cctx is aborted
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "")
} else {
switch oldStatus {
case types.CctxStatus_PendingOutbound:
gasLimit, err := k.GetRevertGasLimit(ctx, cctx)
if err != nil {
return errors.New("can't get revert tx gas limit" + err.Error())
}
if gasLimit == 0 {
// use same gas limit of outbound as a fallback -- should not happen
gasLimit = cctx.OutboundTxParams[0].OutboundTxGasLimit
}
// create new OutboundTxParams for the revert
revertTxParams := &types.OutboundTxParams{
Receiver: cctx.InboundTxParams.Sender,
ReceiverChainId: cctx.InboundTxParams.SenderChainId,
Amount: cctx.InboundTxParams.Amount,
CoinType: cctx.InboundTxParams.CoinType,
OutboundTxGasLimit: gasLimit,
}
cctx.OutboundTxParams = append(cctx.OutboundTxParams, revertTxParams)
err = k.PayGasAndUpdateCctx(
tmpCtx,
cctx.InboundTxParams.SenderChainId,
&cctx,
cctx.OutboundTxParams[0].Amount,
false,
)
if err != nil {
return err
}
err = k.UpdateNonce(tmpCtx, cctx.InboundTxParams.SenderChainId, &cctx)
if err != nil {
return err
}
cctx.CctxStatus.ChangeStatus(types.CctxStatus_PendingRevert, "Outbound failed, start revert")
case types.CctxStatus_PendingRevert:
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "Outbound failed: revert failed; abort TX")
}
}
newStatus := cctx.CctxStatus.Status.String()
EmitOutboundFailure(ctx, msg, oldStatus.String(), newStatus, cctx)
}
return nil
}()
if err != nil {
// do not commit tmpCtx
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error())
ctx.Logger().Error(err.Error())
// #nosec G701 always in range
k.RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce))
k.RemoveOutTxTracker(ctx, msg.OutTxChain, msg.OutTxTssNonce)
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
return &types.MsgVoteOnObservedOutboundTxResponse{}, nil
}
commit()
// Set the ballot index to the finalized ballot
cctx.GetCurrentOutTxParam().OutboundTxBallotIndex = ballotIndex
// #nosec G701 always in range
k.RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce))
k.RemoveOutTxTracker(ctx, msg.OutTxChain, msg.OutTxTssNonce)
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
return &types.MsgVoteOnObservedOutboundTxResponse{}, nil
}
func percentOf(n *big.Int, percent int64) *big.Int {
n = n.Mul(n, big.NewInt(percent))
n = n.Div(n, big.NewInt(100))
return n
}
// FundGasStabilityPoolFromRemainingFees funds the gas stability pool with the remaining fees of an outbound tx
func (k Keeper) FundGasStabilityPoolFromRemainingFees(ctx sdk.Context, outboundTxParams types.OutboundTxParams, chainID int64) error {
gasUsed := outboundTxParams.OutboundTxGasUsed
gasLimit := outboundTxParams.OutboundTxEffectiveGasLimit
gasPrice := math.NewUintFromBigInt(outboundTxParams.OutboundTxEffectiveGasPrice.BigInt())
if gasLimit == gasUsed {
return nil
}
// We skip gas stability pool funding if one of the params is zero
if gasLimit > 0 && gasUsed > 0 && !gasPrice.IsZero() {
if gasLimit > gasUsed {
remainingGas := gasLimit - gasUsed
remainingFees := math.NewUint(remainingGas).Mul(gasPrice).BigInt()
// We fund the stability pool with a portion of the remaining fees
remainingFees = percentOf(remainingFees, RemainingFeesToStabilityPoolPercent)
// Fund the gas stability pool
if err := k.fungibleKeeper.FundGasStabilityPool(ctx, chainID, remainingFees); err != nil {
return err
}
} else {
return fmt.Errorf("VoteOnObservedOutboundTx: The gas limit %d is less than the gas used %d", gasLimit, gasUsed)
}
}
return nil
}
package keeper
import (
"context"
"fmt"
"math/big"
"sort"
"strconv"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// SetGasPrice set a specific gasPrice in the store from its index
func (k Keeper) SetGasPrice(ctx sdk.Context, gasPrice types.GasPrice) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey))
b := k.cdc.MustMarshal(&gasPrice)
gasPrice.Index = strconv.FormatInt(gasPrice.ChainId, 10)
store.Set(types.KeyPrefix(gasPrice.Index), b)
}
// GetGasPrice returns a gasPrice from its index
func (k Keeper) GetGasPrice(ctx sdk.Context, chainID int64) (val types.GasPrice, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey))
b := store.Get(types.KeyPrefix(strconv.FormatInt(chainID, 10)))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) GetMedianGasPriceInUint(ctx sdk.Context, chainID int64) (sdk.Uint, bool) {
gasPrice, isFound := k.GetGasPrice(ctx, chainID)
if !isFound {
return math.ZeroUint(), isFound
}
mi := gasPrice.MedianIndex
return sdk.NewUint(gasPrice.Prices[mi]), true
}
// RemoveGasPrice removes a gasPrice from the store
func (k Keeper) RemoveGasPrice(ctx sdk.Context, index string) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey))
store.Delete(types.KeyPrefix(index))
}
// GetAllGasPrice returns all gasPrice
func (k Keeper) GetAllGasPrice(ctx sdk.Context) (list []types.GasPrice) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.GasPrice
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
// Queries
func (k Keeper) GasPriceAll(c context.Context, req *types.QueryAllGasPriceRequest) (*types.QueryAllGasPriceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var gasPrices []*types.GasPrice
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
gasPriceStore := prefix.NewStore(store, types.KeyPrefix(types.GasPriceKey))
pageRes, err := query.Paginate(gasPriceStore, req.Pagination, func(key []byte, value []byte) error {
var gasPrice types.GasPrice
if err := k.cdc.Unmarshal(value, &gasPrice); err != nil {
return err
}
gasPrices = append(gasPrices, &gasPrice)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllGasPriceResponse{GasPrice: gasPrices, Pagination: pageRes}, nil
}
func (k Keeper) GasPrice(c context.Context, req *types.QueryGetGasPriceRequest) (*types.QueryGetGasPriceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
chainID, err := strconv.Atoi(req.Index)
if err != nil {
return nil, err
}
val, found := k.GetGasPrice(ctx, int64(chainID))
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
return &types.QueryGetGasPriceResponse{GasPrice: &val}, nil
}
// MESSAGES
// Submit information about the connected chain's gas price at a specific block
// height. Gas price submitted by each validator is recorded separately and a
// median index is updated.
//
// Only observer validators are authorized to broadcast this message.
func (k msgServer) GasPriceVoter(goCtx context.Context, msg *types.MsgGasPriceVoter) (*types.MsgGasPriceVoterResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId)
if chain == nil {
return nil, observertypes.ErrSupportedChains
}
if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain); !ok {
return nil, observertypes.ErrNotAuthorizedPolicy
}
if chain == nil {
return nil, sdkerrors.Wrap(types.ErrUnsupportedChain, fmt.Sprintf("ChainID : %d ", msg.ChainId))
}
gasPrice, isFound := k.GetGasPrice(ctx, chain.ChainId)
if !isFound {
gasPrice = types.GasPrice{
Creator: msg.Creator,
Index: strconv.FormatInt(chain.ChainId, 10), // TODO : Not needed index set at keeper
ChainId: chain.ChainId,
Prices: []uint64{msg.Price},
BlockNums: []uint64{msg.BlockNumber},
Signers: []string{msg.Creator},
MedianIndex: 0,
}
} else {
signers := gasPrice.Signers
exist := false
for i, s := range signers {
if s == msg.Creator { // update existing entry
gasPrice.BlockNums[i] = msg.BlockNumber
gasPrice.Prices[i] = msg.Price
exist = true
break
}
}
if !exist {
gasPrice.Signers = append(gasPrice.Signers, msg.Creator)
gasPrice.BlockNums = append(gasPrice.BlockNums, msg.BlockNumber)
gasPrice.Prices = append(gasPrice.Prices, msg.Price)
}
// recompute the median gas price
mi := medianOfArray(gasPrice.Prices)
// #nosec G701 always positive
gasPrice.MedianIndex = uint64(mi)
}
k.SetGasPrice(ctx, gasPrice)
chainIDBigINT := big.NewInt(chain.ChainId)
gasUsed, err := k.fungibleKeeper.SetGasPrice(
ctx,
chainIDBigINT,
math.NewUint(gasPrice.Prices[gasPrice.MedianIndex]).BigInt(),
)
if err != nil {
return nil, err
}
// reset the gas count
k.ResetGasMeterAndConsumeGas(ctx, gasUsed)
return &types.MsgGasPriceVoterResponse{}, nil
}
type indexValue struct {
Index int
Value uint64
}
func medianOfArray(values []uint64) int {
array := make([]indexValue, len(values))
for i, v := range values {
array[i] = indexValue{Index: i, Value: v}
}
sort.SliceStable(array, func(i, j int) bool {
return array[i].Value < array[j].Value
})
l := len(array)
return array[l/2].Index
}
// ResetGasMeterAndConsumeGas reset first the gas meter consumed value to zero and set it back to the new value
// 'gasUsed'
func (k *Keeper) ResetGasMeterAndConsumeGas(ctx sdk.Context, gasUsed uint64) {
// reset the gas count
ctx.GasMeter().RefundGas(ctx.GasMeter().GasConsumed(), "reset the gas count")
ctx.GasMeter().ConsumeGas(gasUsed, "apply evm transaction")
}
package keeper
import (
"context"
math2 "math"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// SetLastBlockHeight set a specific lastBlockHeight in the store from its index
func (k Keeper) SetLastBlockHeight(ctx sdk.Context, lastBlockHeight types.LastBlockHeight) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey))
b := k.cdc.MustMarshal(&lastBlockHeight)
store.Set(types.KeyPrefix(lastBlockHeight.Index), b)
}
// GetLastBlockHeight returns a lastBlockHeight from its index
func (k Keeper) GetLastBlockHeight(ctx sdk.Context, index string) (val types.LastBlockHeight, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey))
b := store.Get(types.KeyPrefix(index))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveLastBlockHeight removes a lastBlockHeight from the store
func (k Keeper) RemoveLastBlockHeight(ctx sdk.Context, index string) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey))
store.Delete(types.KeyPrefix(index))
}
// GetAllLastBlockHeight returns all lastBlockHeight
func (k Keeper) GetAllLastBlockHeight(ctx sdk.Context) (list []types.LastBlockHeight) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.LastBlockHeight
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
// Queries
func (k Keeper) LastBlockHeightAll(c context.Context, req *types.QueryAllLastBlockHeightRequest) (*types.QueryAllLastBlockHeightResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var lastBlockHeights []*types.LastBlockHeight
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
lastBlockHeightStore := prefix.NewStore(store, types.KeyPrefix(types.LastBlockHeightKey))
pageRes, err := query.Paginate(lastBlockHeightStore, req.Pagination, func(key []byte, value []byte) error {
var lastBlockHeight types.LastBlockHeight
if err := k.cdc.Unmarshal(value, &lastBlockHeight); err != nil {
return err
}
lastBlockHeights = append(lastBlockHeights, &lastBlockHeight)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllLastBlockHeightResponse{LastBlockHeight: lastBlockHeights, Pagination: pageRes}, nil
}
func (k Keeper) LastBlockHeight(c context.Context, req *types.QueryGetLastBlockHeightRequest) (*types.QueryGetLastBlockHeightResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetLastBlockHeight(ctx, req.Index)
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
if val.LastSendHeight < 0 || val.LastSendHeight >= math2.MaxInt64 {
return nil, status.Error(codes.OutOfRange, "invalid last send height")
}
if val.LastReceiveHeight < 0 || val.LastReceiveHeight >= math2.MaxInt64 {
return nil, status.Error(codes.OutOfRange, "invalid last recv height")
}
return &types.QueryGetLastBlockHeightResponse{LastBlockHeight: &val}, nil
}
package keeper
import (
"context"
"math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) LastZetaHeight(goCtx context.Context, req *types.QueryLastZetaHeightRequest) (*types.QueryLastZetaHeightResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
height := ctx.BlockHeight()
if height >= math.MaxInt64 || height < 0 {
return nil, status.Error(codes.OutOfRange, "height out of range")
}
return &types.QueryLastZetaHeightResponse{
Height: height,
}, nil
}
package keeper
import (
"context"
"fmt"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func getOutTrackerIndex(chainID int64, nonce uint64) string {
return fmt.Sprintf("%d-%d", chainID, nonce)
}
// SetOutTxTracker set a specific outTxTracker in the store from its index
func (k Keeper) SetOutTxTracker(ctx sdk.Context, outTxTracker types.OutTxTracker) {
outTxTracker.Index = getOutTrackerIndex(outTxTracker.ChainId, outTxTracker.Nonce)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix))
b := k.cdc.MustMarshal(&outTxTracker)
store.Set(types.OutTxTrackerKey(
outTxTracker.Index,
), b)
}
// GetOutTxTracker returns a outTxTracker from its index
func (k Keeper) GetOutTxTracker(
ctx sdk.Context,
chainID int64,
nonce uint64,
) (val types.OutTxTracker, found bool) {
index := getOutTrackerIndex(chainID, nonce)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix))
b := store.Get(types.OutTxTrackerKey(
index,
))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveOutTxTracker removes a outTxTracker from the store
func (k Keeper) RemoveOutTxTracker(
ctx sdk.Context,
chainID int64,
nonce uint64,
) {
index := getOutTrackerIndex(chainID, nonce)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix))
store.Delete(types.OutTxTrackerKey(
index,
))
}
// GetAllOutTxTracker returns all outTxTracker
func (k Keeper) GetAllOutTxTracker(ctx sdk.Context) (list []types.OutTxTracker) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.OutTxTracker
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
// Queries
func (k Keeper) OutTxTrackerAll(c context.Context, req *types.QueryAllOutTxTrackerRequest) (*types.QueryAllOutTxTrackerResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var outTxTrackers []types.OutTxTracker
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
outTxTrackerStore := prefix.NewStore(store, types.KeyPrefix(types.OutTxTrackerKeyPrefix))
pageRes, err := query.Paginate(outTxTrackerStore, req.Pagination, func(key []byte, value []byte) error {
var outTxTracker types.OutTxTracker
if err := k.cdc.Unmarshal(value, &outTxTracker); err != nil {
return err
}
outTxTrackers = append(outTxTrackers, outTxTracker)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllOutTxTrackerResponse{OutTxTracker: outTxTrackers, Pagination: pageRes}, nil
}
func (k Keeper) OutTxTrackerAllByChain(c context.Context, req *types.QueryAllOutTxTrackerByChainRequest) (*types.QueryAllOutTxTrackerByChainResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var outTxTrackers []types.OutTxTracker
ctx := sdk.UnwrapSDKContext(c)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix))
chainStore := prefix.NewStore(store, types.KeyPrefix(fmt.Sprintf("%d-", req.Chain)))
pageRes, err := query.Paginate(chainStore, req.Pagination, func(key []byte, value []byte) error {
var outTxTracker types.OutTxTracker
if err := k.cdc.Unmarshal(value, &outTxTracker); err != nil {
return err
}
outTxTrackers = append(outTxTrackers, outTxTracker)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllOutTxTrackerByChainResponse{OutTxTracker: outTxTrackers, Pagination: pageRes}, nil
}
func (k Keeper) OutTxTracker(c context.Context, req *types.QueryGetOutTxTrackerRequest) (*types.QueryGetOutTxTrackerResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetOutTxTracker(
ctx,
req.ChainID,
req.Nonce,
)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetOutTxTrackerResponse{OutTxTracker: val}, nil
}
// Messages
// RemoveFromOutTxTracker removes a record from the outbound transaction tracker by chain ID and nonce.
// only the admin policy account is authorized to broadcast this message.
func (k msgServer) RemoveFromOutTxTracker(goCtx context.Context, msg *types.MsgRemoveFromOutTxTracker) (*types.MsgRemoveFromOutTxTrackerResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) {
return &types.MsgRemoveFromOutTxTrackerResponse{}, observertypes.ErrNotAuthorizedPolicy
}
k.RemoveOutTxTracker(ctx, msg.ChainId, msg.Nonce)
return &types.MsgRemoveFromOutTxTrackerResponse{}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(_ sdk.Context) types.Params {
return types.NewParams()
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, ¶ms)
}
//Queries
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil
}
package keeper
import (
"context"
"fmt"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// CRUD
func (k Keeper) SetNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix))
b := k.cdc.MustMarshal(&nonceToCctx)
store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonceToCctx.Tss, nonceToCctx.ChainId, nonceToCctx.Nonce)), b)
}
func (k Keeper) GetNonceToCctx(ctx sdk.Context, tss string, chainID int64, nonce int64) (val types.NonceToCctx, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix))
b := store.Get(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", tss, chainID, nonce)))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) RemoveNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix))
store.Delete(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonceToCctx.Tss, nonceToCctx.ChainId, nonceToCctx.Nonce)))
}
func (k Keeper) SetPendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix))
b := k.cdc.MustMarshal(&pendingNonces)
store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d", pendingNonces.Tss, pendingNonces.ChainId)), b)
}
func (k Keeper) GetPendingNonces(ctx sdk.Context, tss string, chainID int64) (val types.PendingNonces, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix))
b := store.Get(types.KeyPrefix(fmt.Sprintf("%s-%d", tss, chainID)))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) GetAllPendingNonces(ctx sdk.Context) (list []*types.PendingNonces) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.PendingNonces
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, &val)
}
return
}
func (k Keeper) RemovePendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix))
store.Delete(types.KeyPrefix(fmt.Sprintf("%s-%d", pendingNonces.Tss, pendingNonces.ChainId)))
}
// utility
func (k Keeper) RemoveFromPendingNonces(ctx sdk.Context, tssPubkey string, chainID int64, nonce int64) {
p, found := k.GetPendingNonces(ctx, tssPubkey, chainID)
if found && nonce >= p.NonceLow && nonce <= p.NonceHigh {
p.NonceLow = nonce + 1
k.SetPendingNonces(ctx, p)
}
}
func (k Keeper) PendingNoncesAll(c context.Context, req *types.QueryAllPendingNoncesRequest) (*types.QueryAllPendingNoncesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
list := k.GetAllPendingNonces(ctx)
return &types.QueryAllPendingNoncesResponse{
PendingNonces: list,
}, nil
}
func (k Keeper) PendingNoncesByChain(c context.Context, req *types.QueryPendingNoncesByChainRequest) (*types.QueryPendingNoncesByChainResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
tss, found := k.GetTSS(ctx)
if !found {
return nil, status.Error(codes.NotFound, "tss not found")
}
list, found := k.GetPendingNonces(ctx, tss.TssPubkey, req.ChainId)
if !found {
return nil, status.Error(codes.NotFound, fmt.Sprintf("pending nonces not found for chain id : %d", req.ChainId))
}
return &types.QueryPendingNoncesByChainResponse{
PendingNonces: list,
}, nil
}
package keeper
import (
"context"
"fmt"
"sort"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// AppendTss appends a tss to the TSSHistoryKey store and update the current TSS to the latest one
func (k Keeper) AppendTss(ctx sdk.Context, tss types.TSS) {
k.SetTSS(ctx, tss)
k.SetTSSHistory(ctx, tss)
}
func (k Keeper) SetTssAndUpdateNonce(ctx sdk.Context, tss types.TSS) {
k.SetTSS(ctx, tss)
// initialize the nonces and pending nonces of all enabled chains
supportedChains := k.zetaObserverKeeper.GetParams(ctx).GetSupportedChains()
for _, chain := range supportedChains {
chainNonce := types.ChainNonces{
Index: chain.ChainName.String(),
ChainId: chain.ChainId,
Nonce: 0,
// #nosec G701 always positive
FinalizedHeight: uint64(ctx.BlockHeight()),
}
k.SetChainNonces(ctx, chainNonce)
p := types.PendingNonces{
NonceLow: 0,
NonceHigh: 0,
ChainId: chain.ChainId,
Tss: tss.TssPubkey,
}
k.SetPendingNonces(ctx, p)
}
}
// SetTSS sets tss information to the store
func (k Keeper) SetTSS(ctx sdk.Context, tss types.TSS) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSKey))
b := k.cdc.MustMarshal(&tss)
store.Set([]byte{0}, b)
}
// SetTSSHistory Sets a new TSS into the TSS history store
func (k Keeper) SetTSSHistory(ctx sdk.Context, tss types.TSS) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSHistoryKey))
b := k.cdc.MustMarshal(&tss)
store.Set(types.KeyPrefix(fmt.Sprintf("%d", tss.FinalizedZetaHeight)), b)
}
// GetTSS returns the current tss information
func (k Keeper) GetTSS(ctx sdk.Context) (val types.TSS, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveTSS removes tss information from the store
func (k Keeper) RemoveTSS(ctx sdk.Context) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSKey))
store.Delete([]byte{0})
}
// GetAllTSS returns all tss historical information from the store
func (k Keeper) GetAllTSS(ctx sdk.Context) (list []types.TSS) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSHistoryKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.TSS
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
// GetPreviousTSS returns the previous tss information
func (k Keeper) GetPreviousTSS(ctx sdk.Context) (val types.TSS, found bool) {
tssList := k.GetAllTSS(ctx)
if len(tssList) < 2 {
return val, false
}
// Sort tssList by FinalizedZetaHeight
sort.SliceStable(tssList, func(i, j int) bool {
return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight
})
return tssList[len(tssList)-2], true
}
func (k Keeper) CheckIfTssPubkeyHasBeenGenerated(ctx sdk.Context, tssPubkey string) (types.TSS, bool) {
tssList := k.GetAllTSS(ctx)
for _, tss := range tssList {
if tss.TssPubkey == tssPubkey {
return tss, true
}
}
return types.TSS{}, false
}
// Queries
func (k Keeper) TSS(c context.Context, req *types.QueryGetTSSRequest) (*types.QueryGetTSSResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetTSS(ctx)
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
return &types.QueryGetTSSResponse{TSS: &val}, nil
}
// TssHistory Query historical list of TSS information
func (k Keeper) TssHistory(c context.Context, _ *types.QueryTssHistoryRequest) (*types.QueryTssHistoryResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
tssList := k.GetAllTSS(ctx)
sort.SliceStable(tssList, func(i, j int) bool {
return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight
})
return &types.QueryTssHistoryResponse{TssList: tssList}, nil
}
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
v2 "github.com/zeta-chain/zetacore/x/crosschain/migrations/v2"
v3 "github.com/zeta-chain/zetacore/x/crosschain/migrations/v3"
)
// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
crossChainKeeper Keeper
}
// NewMigrator returns a new Migrator.
func NewMigrator(keeper Keeper) Migrator {
return Migrator{
crossChainKeeper: keeper,
}
}
// Migrate2to3 migrates the store from consensus version 2 to 3
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2.MigrateStore(ctx, m.crossChainKeeper.zetaObserverKeeper, m.crossChainKeeper.storeKey, m.crossChainKeeper.cdc)
}
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
return v3.MigrateStore(ctx, m.crossChainKeeper.storeKey, m.crossChainKeeper.cdc)
}
package keeper
import (
"context"
"fmt"
"sort"
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/crypto"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
func (k msgServer) MigrateTssFunds(goCtx context.Context, msg *types.MsgMigrateTssFunds) (*types.MsgMigrateTssFundsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observerTypes.Policy_Type_group2) {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account")
}
if k.zetaObserverKeeper.IsInboundEnabled(ctx) {
return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot migrate funds while inbound is enabled")
}
tss, found := k.GetTSS(ctx)
if !found {
return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot find current TSS")
}
pendingNonces, found := k.GetPendingNonces(ctx, tss.TssPubkey, msg.ChainId)
if !found {
return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot find pending nonces for chain")
}
if pendingNonces.NonceLow != pendingNonces.NonceHigh {
return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot migrate funds when there are pending nonces")
}
err := k.MigrateTSSFundsForChain(ctx, msg.ChainId, msg.Amount, tss)
if err != nil {
return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, err.Error())
}
return &types.MsgMigrateTssFundsResponse{}, nil
}
func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount sdkmath.Uint, currentTss types.TSS) error {
tssList := k.GetAllTSS(ctx)
if len(tssList) < 2 {
return errorsmod.Wrap(types.ErrCannotMigrateTss, "only one TSS found")
}
// Sort tssList by FinalizedZetaHeight
sort.SliceStable(tssList, func(i, j int) bool {
return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight
})
// Always migrate to the latest TSS if multiple TSS addresses have been generated
newTss := tssList[len(tssList)-1]
ethAddressOld, err := getTssAddrEVM(currentTss.TssPubkey)
if err != nil {
return err
}
btcAddressOld, err := getTssAddrBTC(currentTss.TssPubkey)
if err != nil {
return err
}
ethAddressNew, err := getTssAddrEVM(newTss.TssPubkey)
if err != nil {
return err
}
btcAddressNew, err := getTssAddrBTC(newTss.TssPubkey)
if err != nil {
return err
}
medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID)
if !isFound {
return types.ErrUnableToGetGasPrice
}
indexString := fmt.Sprintf("%s-%s-%d-%s-%d", currentTss.TssPubkey, newTss.TssPubkey, chainID, amount.String(), ctx.BlockHeight())
hash := crypto.Keccak256Hash([]byte(indexString))
index := hash.Hex()
cctx := types.CrossChainTx{
Creator: "",
Index: index,
ZetaFees: sdkmath.Uint{},
RelayedMessage: fmt.Sprintf("%s:%s", common.CmdMigrateTssFunds, "Funds Migrator Admin Cmd"),
CctxStatus: &types.Status{
Status: types.CctxStatus_PendingOutbound,
StatusMessage: "",
LastUpdateTimestamp: 0,
},
InboundTxParams: &types.InboundTxParams{
Sender: "",
SenderChainId: chainID,
TxOrigin: "",
CoinType: common.CoinType_Cmd,
Asset: "",
Amount: amount,
InboundTxObservedHash: tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()).String(),
InboundTxObservedExternalHeight: 0,
InboundTxBallotIndex: "",
InboundTxFinalizedZetaHeight: 0,
},
OutboundTxParams: []*types.OutboundTxParams{{
Receiver: "",
ReceiverChainId: chainID,
CoinType: common.CoinType_Cmd,
Amount: amount,
OutboundTxTssNonce: 0,
OutboundTxGasLimit: 1_000_000,
OutboundTxGasPrice: medianGasPrice.MulUint64(2).String(),
OutboundTxHash: "",
OutboundTxBallotIndex: "",
OutboundTxObservedExternalHeight: 0,
OutboundTxGasUsed: 0,
OutboundTxEffectiveGasPrice: sdkmath.Int{},
OutboundTxEffectiveGasLimit: 0,
TssPubkey: currentTss.TssPubkey,
}}}
if common.IsEVMChain(chainID) {
cctx.InboundTxParams.Sender = ethAddressOld.String()
cctx.GetCurrentOutTxParam().Receiver = ethAddressNew.String()
}
if common.IsBitcoinChain(chainID) {
cctx.InboundTxParams.Sender = btcAddressOld
cctx.GetCurrentOutTxParam().Receiver = btcAddressNew
}
if cctx.GetCurrentOutTxParam().Receiver == "" {
return errorsmod.Wrap(types.ErrCannotMigrateTss, fmt.Sprintf("chain %d is not supported", chainID))
}
err = k.UpdateNonce(ctx, chainID, &cctx)
if err != nil {
return err
}
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
EmitEventInboundFinalized(ctx, &cctx)
return nil
}
package keeper
import (
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
type msgServer struct {
Keeper
}
// NewMsgServerImpl returns an implementation of the MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper} //nolint:typecheck
}
var _ types.MsgServer = msgServer{} //nolint:typecheck
package keeper
import (
"context"
"fmt"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// TODO https://github.com/zeta-chain/node/issues/1269
func (k msgServer) AddToInTxTracker(goCtx context.Context, msg *types.MsgAddToInTxTracker) (*types.MsgAddToInTxTrackerResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId)
if chain == nil {
return nil, observertypes.ErrSupportedChains
}
adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1)
isAdmin := msg.Creator == adminPolicyAccount
isObserver := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain)
isProven := false
if !(isAdmin || isObserver) && msg.Proof != nil {
txBytes, err := k.VerifyProof(ctx, msg.Proof, msg.ChainId, msg.BlockHash, msg.TxIndex)
if err != nil {
return nil, types.ErrProofVerificationFail.Wrapf(err.Error())
}
if common.IsEVMChain(msg.ChainId) {
err = k.VerifyEVMInTxBody(ctx, msg, txBytes)
if err != nil {
return nil, types.ErrTxBodyVerificationFail.Wrapf(err.Error())
}
} else {
return nil, types.ErrTxBodyVerificationFail.Wrapf(fmt.Sprintf("cannot verify inTx body for chain %d", msg.ChainId))
}
isProven = true
}
// Sender needs to be either the admin policy account or an observer
if !(isAdmin || isObserver || isProven) {
return nil, errorsmod.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator))
}
k.SetInTxTracker(ctx, types.InTxTracker{
ChainId: msg.ChainId,
TxHash: msg.TxHash,
CoinType: msg.CoinType,
})
return &types.MsgAddToInTxTrackerResponse{}, nil
}
package keeper
import (
"context"
"fmt"
"math/big"
"strings"
cosmoserrors "cosmossdk.io/errors"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil"
sdk "github.com/cosmos/cosmos-sdk/types"
eth "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
)
// AddToOutTxTracker adds a new record to the outbound transaction tracker.
// only the admin policy account and the observer validators are authorized to broadcast this message without proof.
func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToOutTxTracker) (*types.MsgAddToOutTxTrackerResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId)
if chain == nil {
return nil, observertypes.ErrSupportedChains
}
if msg.Proof == nil { // without proof, only certain accounts can send this message
adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1)
isAdmin := msg.Creator == adminPolicyAccount
isObserver := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain)
// Sender needs to be either the admin policy account or an observer
if !(isAdmin || isObserver) {
return nil, cosmoserrors.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator))
}
}
isProven := false
if msg.Proof != nil { // verify proof when it is provided
txBytes, err := k.VerifyProof(ctx, msg.Proof, msg.ChainId, msg.BlockHash, msg.TxIndex)
if err != nil {
return nil, types.ErrProofVerificationFail.Wrapf(err.Error())
}
err = k.VerifyOutTxBody(ctx, msg, txBytes)
if err != nil {
return nil, types.ErrTxBodyVerificationFail.Wrapf(err.Error())
}
isProven = true
}
tracker, found := k.GetOutTxTracker(ctx, msg.ChainId, msg.Nonce)
hash := types.TxHashList{
TxHash: msg.TxHash,
TxSigner: msg.Creator,
}
if !found {
k.SetOutTxTracker(ctx, types.OutTxTracker{
Index: "",
ChainId: chain.ChainId,
Nonce: msg.Nonce,
HashList: []*types.TxHashList{&hash},
})
return &types.MsgAddToOutTxTrackerResponse{}, nil
}
var isDup = false
for _, hash := range tracker.HashList {
if strings.EqualFold(hash.TxHash, msg.TxHash) {
isDup = true
if isProven {
hash.Proved = true
k.SetOutTxTracker(ctx, tracker)
k.Logger(ctx).Info("Proof'd outbound transaction")
return &types.MsgAddToOutTxTrackerResponse{}, nil
}
break
}
}
if !isDup {
if isProven {
hash.Proved = true
tracker.HashList = append([]*types.TxHashList{&hash}, tracker.HashList...)
k.Logger(ctx).Info("Proof'd outbound transaction")
} else {
tracker.HashList = append(tracker.HashList, &hash)
}
k.SetOutTxTracker(ctx, tracker)
}
return &types.MsgAddToOutTxTrackerResponse{}, nil
}
func (k Keeper) VerifyOutTxBody(ctx sdk.Context, msg *types.MsgAddToOutTxTracker, txBytes []byte) error {
// get tss address
tss, err := k.GetTssAddress(ctx, &types.QueryGetTssAddressRequest{})
if err != nil {
return err
}
// verify message against transaction body
if common.IsEVMChain(msg.ChainId) {
err = VerifyEVMOutTxBody(msg, txBytes, tss.Eth)
} else if common.IsBitcoinChain(msg.ChainId) {
err = VerifyBTCOutTxBody(msg, txBytes, tss.Btc)
} else {
return fmt.Errorf("cannot verify outTx body for chain %d", msg.ChainId)
}
return err
}
// VerifyEVMOutTxBody validates the sender address, nonce, chain id and tx hash.
// Note: 'msg' may contain fabricated information
func VerifyEVMOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssEth string) error {
var txx ethtypes.Transaction
err := txx.UnmarshalBinary(txBytes)
if err != nil {
return err
}
signer := ethtypes.NewLondonSigner(txx.ChainId())
sender, err := ethtypes.Sender(signer, &txx)
if err != nil {
return err
}
tssAddr := eth.HexToAddress(tssEth)
if tssAddr == (eth.Address{}) {
return fmt.Errorf("tss address not found")
}
if sender != tssAddr {
return fmt.Errorf("sender %s is not tss address", sender)
}
if txx.ChainId().Cmp(big.NewInt(msg.ChainId)) != 0 {
return fmt.Errorf("want evm chain id %d, got %d", txx.ChainId(), msg.ChainId)
}
if txx.Nonce() != msg.Nonce {
return fmt.Errorf("want nonce %d, got %d", txx.Nonce(), msg.Nonce)
}
if txx.Hash().Hex() != msg.TxHash {
return fmt.Errorf("want tx hash %s, got %s", txx.Hash().Hex(), msg.TxHash)
}
return nil
}
// VerifyBTCOutTxBody validates the SegWit sender address, nonce and chain id and tx hash
// Note: 'msg' may contain fabricated information
func VerifyBTCOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssBtc string) error {
tx, err := btcutil.NewTxFromBytes(txBytes)
if err != nil {
return err
}
for _, vin := range tx.MsgTx().TxIn {
if len(vin.Witness) != 2 { // outTx is SegWit transaction for now
return fmt.Errorf("not a SegWit transaction")
}
pubKey, err := btcec.ParsePubKey(vin.Witness[1], btcec.S256())
if err != nil {
return fmt.Errorf("failed to parse public key")
}
addrP2WPKH, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubKey.SerializeCompressed()), config.BitconNetParams)
if err != nil {
return fmt.Errorf("failed to create P2WPKH address")
}
if addrP2WPKH.EncodeAddress() != tssBtc {
return fmt.Errorf("sender %s is not tss address", addrP2WPKH.EncodeAddress())
}
}
if common.BtcChainID() != msg.ChainId {
return fmt.Errorf("want btc chain id %d, got %d", common.BtcChainID(), msg.ChainId)
}
if len(tx.MsgTx().TxOut) < 1 {
return fmt.Errorf("outTx should have at least one output")
}
if tx.MsgTx().TxOut[0].Value != common.NonceMarkAmount(msg.Nonce) {
return fmt.Errorf("want nonce mark %d, got %d", tx.MsgTx().TxOut[0].Value, common.NonceMarkAmount(msg.Nonce))
}
if tx.MsgTx().TxHash().String() != msg.TxHash {
return fmt.Errorf("want tx hash %s, got %s", tx.MsgTx().TxHash(), msg.TxHash)
}
return nil
}
package keeper
import (
"context"
"fmt"
"math/big"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// WhitelistERC20 deploys a new zrc20, create a foreign coin object for the ERC20
// and emit a crosschain tx to whitelist the ERC20 on the external chain
func (k msgServer) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC20) (*types.MsgWhitelistERC20Response, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group1) {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
}
erc20Addr := ethcommon.HexToAddress(msg.Erc20Address)
if erc20Addr == (ethcommon.Address{}) {
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid ERC20 contract address (%s)", msg.Erc20Address)
}
// check if the erc20 is already whitelisted
foreignCoins := k.fungibleKeeper.GetAllForeignCoins(ctx)
for _, fCoin := range foreignCoins {
assetAddr := ethcommon.HexToAddress(fCoin.Asset)
if assetAddr == erc20Addr && fCoin.ForeignChainId == msg.ChainId {
return nil, errorsmod.Wrapf(
fungibletypes.ErrForeignCoinAlreadyExist,
"ERC20 contract address (%s) already whitelisted on chain (%d)",
msg.Erc20Address,
msg.ChainId,
)
}
}
tss, found := k.GetTSS(ctx)
if !found {
return nil, errorsmod.Wrapf(types.ErrCannotFindTSSKeys, "Cannot create new admin cmd of type whitelistERC20")
}
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId)
if chain == nil {
return nil, errorsmod.Wrapf(types.ErrInvalidChainID, "chain id (%d) not supported", msg.ChainId)
}
// use a temporary context for the zrc20 deployment
tmpCtx, commit := ctx.CacheContext()
// add to the foreign coins. Deploy ZRC20 contract for it.
zrc20Addr, err := k.fungibleKeeper.DeployZRC20Contract(
tmpCtx,
msg.Name,
msg.Symbol,
// #nosec G701 always in range
uint8(msg.Decimals),
chain.ChainId,
common.CoinType_ERC20,
msg.Erc20Address,
big.NewInt(msg.GasLimit),
)
if err != nil {
return nil, errorsmod.Wrapf(
types.ErrDeployContract,
"failed to deploy ZRC20 contract for ERC20 contract address (%s) on chain (%d)",
msg.Erc20Address,
msg.ChainId,
)
}
if zrc20Addr == (ethcommon.Address{}) {
return nil, errorsmod.Wrapf(
types.ErrDeployContract,
"deployed ZRC20 return 0 address for ERC20 contract address (%s) on chain (%d)",
msg.Erc20Address,
msg.ChainId,
)
}
// get necessary parameters to create the cctx
param, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, msg.ChainId)
if !found {
return nil, errorsmod.Wrapf(types.ErrInvalidChainID, "core params not found for chain id (%d)", msg.ChainId)
}
medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, msg.ChainId)
if !isFound {
return nil, errorsmod.Wrapf(types.ErrUnableToGetGasPrice, "median gas price not found for chain id (%d)", msg.ChainId)
}
medianGasPrice = medianGasPrice.MulUint64(2) // overpays gas price by 2x
// calculate the cctx index
// we use the deployed zrc20 contract address to generate a unique index
// since other parts of the system may use the zrc20 for the index, we add a message specific suffix
hash := crypto.Keccak256Hash(zrc20Addr.Bytes(), []byte("WhitelistERC20"))
index := hash.Hex()
// create a cmd cctx to whitelist the erc20 on the external chain
cctx := types.CrossChainTx{
Creator: msg.Creator,
Index: index,
ZetaFees: sdk.NewUint(0),
RelayedMessage: fmt.Sprintf("%s:%s", common.CmdWhitelistERC20, msg.Erc20Address),
CctxStatus: &types.Status{
Status: types.CctxStatus_PendingOutbound,
StatusMessage: "",
LastUpdateTimestamp: 0,
},
InboundTxParams: &types.InboundTxParams{
Sender: "",
SenderChainId: 0,
TxOrigin: "",
CoinType: common.CoinType_Cmd,
Asset: "",
Amount: math.Uint{},
InboundTxObservedHash: hash.String(), // all Upper case Cosmos TX HEX, with no 0x prefix
InboundTxObservedExternalHeight: 0,
InboundTxBallotIndex: "",
InboundTxFinalizedZetaHeight: 0,
},
OutboundTxParams: []*types.OutboundTxParams{
{
Receiver: param.Erc20CustodyContractAddress,
ReceiverChainId: msg.ChainId,
CoinType: common.CoinType_Cmd,
Amount: math.NewUint(0),
OutboundTxTssNonce: 0,
OutboundTxGasLimit: 100_000,
OutboundTxGasPrice: medianGasPrice.String(),
OutboundTxHash: "",
OutboundTxBallotIndex: "",
OutboundTxObservedExternalHeight: 0,
TssPubkey: tss.TssPubkey,
},
},
}
err = k.UpdateNonce(ctx, msg.ChainId, &cctx)
if err != nil {
return nil, err
}
// add to the foreign coins
foreignCoin := fungibletypes.ForeignCoins{
Zrc20ContractAddress: zrc20Addr.Hex(),
Asset: msg.Erc20Address,
ForeignChainId: msg.ChainId,
Decimals: msg.Decimals,
Name: msg.Name,
Symbol: msg.Symbol,
CoinType: common.CoinType_ERC20,
// #nosec G701 always positive
GasLimit: uint64(msg.GasLimit),
}
k.fungibleKeeper.SetForeignCoins(ctx, foreignCoin)
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
commit()
return &types.MsgWhitelistERC20Response{
Zrc20Address: zrc20Addr.Hex(),
CctxIndex: index,
}, nil
}
package keeper
import (
"context"
"fmt"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
math2 "github.com/ethereum/go-ethereum/common/math"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerKeeper "github.com/zeta-chain/zetacore/x/observer/keeper"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// MESSAGES
// CreateTSSVoter votes on creating a TSS key and recording the information about it (public
// key, participant and operator addresses, finalized and keygen heights).
//
// If the vote passes, the information about the TSS key is recorded on chain
// and the status of the keygen is set to "success".
//
// Fails if the keygen does not exist, the keygen has been already
// completed, or the keygen has failed.
//
// Only node accounts are authorized to broadcast this message.
func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSSVoter) (*types.MsgCreateTSSVoterResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if !k.IsAuthorizedNodeAccount(ctx, msg.Creator) {
return nil, errorsmod.Wrap(sdkerrors.ErrorInvalidSigner, fmt.Sprintf("signer %s does not have a node account set", msg.Creator))
}
// No need to create a ballot if keygen does not exist
keygen, found := k.zetaObserverKeeper.GetKeygen(ctx)
if !found {
return &types.MsgCreateTSSVoterResponse{}, observerTypes.ErrKeygenNotFound
}
// USE a separate transaction to update KEYGEN status to pending when trying to change the TSS address
if keygen.Status == observerTypes.KeygenStatus_KeyGenSuccess {
return &types.MsgCreateTSSVoterResponse{}, observerTypes.ErrKeygenCompleted
}
index := msg.Digest()
// Add votes and Set Ballot
// GetBallot checks against the supported chains list before querying for Ballot
// TODO : https://github.com/zeta-chain/node/issues/896
ballot, found := k.zetaObserverKeeper.GetBallot(ctx, index)
if !found {
var voterList []string
for _, nodeAccount := range k.zetaObserverKeeper.GetAllNodeAccount(ctx) {
voterList = append(voterList, nodeAccount.Operator)
}
ballot = observerTypes.Ballot{
Index: "",
BallotIdentifier: index,
VoterList: voterList,
Votes: observerTypes.CreateVotes(len(voterList)),
ObservationType: observerTypes.ObservationType_TSSKeyGen,
BallotThreshold: sdk.MustNewDecFromStr("1.00"),
BallotStatus: observerTypes.BallotStatus_BallotInProgress,
BallotCreationHeight: ctx.BlockHeight(),
}
k.zetaObserverKeeper.AddBallotToList(ctx, ballot)
}
var err error
if msg.Status == common.ReceiveStatus_Success {
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_SuccessObservation)
if err != nil {
return &types.MsgCreateTSSVoterResponse{}, err
}
} else if msg.Status == common.ReceiveStatus_Failed {
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_FailureObservation)
if err != nil {
return &types.MsgCreateTSSVoterResponse{}, err
}
}
if !found {
observerKeeper.EmitEventBallotCreated(ctx, ballot, msg.TssPubkey, "Common-TSS-For-All-Chain")
}
ballot, isFinalized := k.zetaObserverKeeper.CheckIfFinalizingVote(ctx, ballot)
if !isFinalized {
// Return nil here to add vote to ballot and commit state
return &types.MsgCreateTSSVoterResponse{}, nil
}
// Set TSS only on success, set Keygen either way.
// Keygen block can be updated using a policy transaction if keygen fails
if ballot.BallotStatus != observerTypes.BallotStatus_BallotFinalized_FailureObservation {
tss := types.TSS{
TssPubkey: msg.TssPubkey,
TssParticipantList: keygen.GetGranteePubkeys(),
OperatorAddressList: ballot.VoterList,
FinalizedZetaHeight: ctx.BlockHeight(),
KeyGenZetaHeight: msg.KeyGenZetaHeight,
}
// Set TSS history only, current TSS is updated via admin transaction
// In Case this is the first TSS address update both current and history
tssList := k.GetAllTSS(ctx)
if len(tssList) == 0 {
k.SetTssAndUpdateNonce(ctx, tss)
}
k.SetTSSHistory(ctx, tss)
keygen.Status = observerTypes.KeygenStatus_KeyGenSuccess
keygen.BlockNumber = ctx.BlockHeight()
} else if ballot.BallotStatus == observerTypes.BallotStatus_BallotFinalized_FailureObservation {
keygen.Status = observerTypes.KeygenStatus_KeyGenFailed
keygen.BlockNumber = math2.MaxInt64
}
k.zetaObserverKeeper.SetKeygen(ctx, keygen)
return &types.MsgCreateTSSVoterResponse{}, nil
}
func (k msgServer) UpdateTssAddress(goCtx context.Context, msg *types.MsgUpdateTssAddress) (*types.MsgUpdateTssAddressResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// TODO : Add a new policy type for updating the TSS address
if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observerTypes.Policy_Type_group2) {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account")
}
tss, ok := k.CheckIfTssPubkeyHasBeenGenerated(ctx, msg.TssPubkey)
if !ok {
return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "tss pubkey has not been generated")
}
k.SetTssAndUpdateNonce(ctx, tss)
return &types.MsgUpdateTssAddressResponse{}, nil
}
// IsAuthorizedNodeAccount checks whether a signer is authorized to sign , by checking their address against the observer mapper which contains the observer list for the chain and type
func (k Keeper) IsAuthorizedNodeAccount(ctx sdk.Context, address string) bool {
_, found := k.zetaObserverKeeper.GetNodeAccount(ctx, address)
if found {
return true
}
return false
}
//go:build !PRIVNET
// +build !PRIVNET
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (k Keeper) TestWhitelistERC20(_ sdk.Context) error {
return nil
}
package keeper
import (
"fmt"
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
eth "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
func (k Keeper) VerifyProof(ctx sdk.Context, proof *common.Proof, chainID int64, blockHash string, txIndex int64) ([]byte, error) {
// header-based merkle proof verification must be enabled
crosschainFlags, found := k.zetaObserverKeeper.GetCrosschainFlags(ctx)
if !found {
return nil, fmt.Errorf("crosschain flags not found")
}
if crosschainFlags.BlockHeaderVerificationFlags == nil {
return nil, fmt.Errorf("block header verification flags not found")
}
if common.IsBitcoinChain(chainID) && !crosschainFlags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled {
return nil, fmt.Errorf("proof verification not enabled for bitcoin chain")
}
if common.IsEVMChain(chainID) && !crosschainFlags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled {
return nil, fmt.Errorf("proof verification not enabled for evm chain")
}
// chain must support header-based merkle proof verification
senderChain := common.GetChainFromChainID(chainID)
if senderChain == nil {
return nil, types.ErrUnsupportedChain
}
if !senderChain.SupportMerkleProof() {
return nil, fmt.Errorf("chain %d does not support block header-based verification", chainID)
}
// get block header from the store
hashBytes, err := common.StringToHash(chainID, blockHash)
if err != nil {
return nil, fmt.Errorf("block hash %s conversion failed %s", blockHash, err)
}
res, found := k.zetaObserverKeeper.GetBlockHeader(ctx, hashBytes)
if !found {
return nil, fmt.Errorf("block header not found %s", blockHash)
}
// verify merkle proof
txBytes, err := proof.Verify(res.Header, int(txIndex))
if err != nil {
return nil, err
}
return txBytes, err
}
func (k Keeper) VerifyEVMInTxBody(ctx sdk.Context, msg *types.MsgAddToInTxTracker, txBytes []byte) error {
var txx ethtypes.Transaction
err := txx.UnmarshalBinary(txBytes)
if err != nil {
return err
}
if txx.Hash().Hex() != msg.TxHash {
return fmt.Errorf("want tx hash %s, got %s", txx.Hash().Hex(), msg.TxHash)
}
if txx.ChainId().Cmp(big.NewInt(msg.ChainId)) != 0 {
return fmt.Errorf("want evm chain id %d, got %d", txx.ChainId(), msg.ChainId)
}
switch msg.CoinType {
case common.CoinType_Zeta:
coreParams, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, msg.ChainId)
if !found {
return types.ErrUnsupportedChain.Wrapf("core params not found for chain %d", msg.ChainId)
}
if txx.To().Hex() != coreParams.ConnectorContractAddress {
return fmt.Errorf("receiver is not connector contract for coin type %s", msg.CoinType)
}
return nil
case common.CoinType_ERC20:
coreParams, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, msg.ChainId)
if !found {
return types.ErrUnsupportedChain.Wrapf("core params not found for chain %d", msg.ChainId)
}
if txx.To().Hex() != coreParams.Erc20CustodyContractAddress {
return fmt.Errorf("receiver is not erc20Custory contract for coin type %s", msg.CoinType)
}
return nil
case common.CoinType_Gas:
tss, err := k.GetTssAddress(ctx, &types.QueryGetTssAddressRequest{})
if err != nil {
return err
}
tssAddr := eth.HexToAddress(tss.Eth)
if tssAddr == (eth.Address{}) {
return fmt.Errorf("tss address not found")
}
if txx.To().Hex() != tssAddr.Hex() {
return fmt.Errorf("receiver is not tssAddress contract for coin type %s", msg.CoinType)
}
return nil
default:
return fmt.Errorf("coin type %s not supported", msg.CoinType)
}
}
package keeper
import (
"context"
"math/big"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) ConvertGasToZeta(context context.Context, request *types.QueryConvertGasToZetaRequest) (*types.QueryConvertGasToZetaResponse, error) {
ctx := sdk.UnwrapSDKContext(context)
chain := common.GetChainFromChainID(request.ChainId)
if chain == nil {
return nil, zetaObserverTypes.ErrSupportedChains
}
medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chain.ChainId)
if !isFound {
return nil, status.Error(codes.InvalidArgument, "invalid request: param chain")
}
gasLimit := math.NewUintFromString(request.GasLimit)
outTxGasFee := medianGasPrice.Mul(gasLimit).MulUint64(2) //FIXME: parameterize this to sync with where this fee is charged
zrc20, err := k.fungibleKeeper.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chain.ChainId))
if err != nil {
return nil, status.Error(codes.NotFound, "zrc20 not found")
}
outTxGasFeeInZeta, err := k.fungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, outTxGasFee.BigInt(), zrc20)
if err != nil {
return nil, status.Error(codes.Internal, "zQueryUniswapv2RouterGetAmountsIn failed")
}
return &types.QueryConvertGasToZetaResponse{
OutboundGasInZeta: outTxGasFeeInZeta.String(),
ProtocolFeeInZeta: types.GetProtocolFee().String(),
// #nosec G701 always positive
ZetaBlockHeight: uint64(ctx.BlockHeight()),
}, nil
}
func (k Keeper) ProtocolFee(_ context.Context, _ *types.QueryMessagePassingProtocolFeeRequest) (*types.QueryMessagePassingProtocolFeeResponse, error) {
return &types.QueryMessagePassingProtocolFeeResponse{
FeeInZeta: types.GetProtocolFee().String(),
}, nil
}
package crosschain
import (
"context"
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/zeta-chain/zetacore/x/crosschain/keeper"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
)
// ----------------------------------------------------------------------------
// AppModuleBasic
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the crosschain module.
type AppModuleBasic struct {
cdc codec.Codec
}
func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic {
return AppModuleBasic{cdc: cdc}
}
// Name returns the crosschain module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
}
func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
// RegisterInterfaces registers the module's interface types
func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}
// DefaultGenesis returns the crosschain module's default genesis state.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesis())
}
// ValidateGenesis performs genesis state validation for the crosschain module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return genState.Validate()
}
// RegisterRESTRoutes registers the crosschain module's REST service handlers.
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
err := types.RegisterClientCtx(clientCtx)
if err != nil {
fmt.Println("RegisterQueryHandlerClient err: %w", err)
}
err = types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {
fmt.Println("RegisterQueryHandlerClient err: %w", err)
}
}
// GetTxCmd returns the crosschain module's root tx command.
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}
// GetQueryCmd returns the crosschain module's root query command.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(types.StoreKey)
}
// ----------------------------------------------------------------------------
// AppModule
// ----------------------------------------------------------------------------
// AppModule implements the AppModule interface for the crosschain module.
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
stakingKeeper types.StakingKeeper
authKeeper types.AccountKeeper
}
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
stakingKeeper types.StakingKeeper,
authKeeper types.AccountKeeper,
) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
stakingKeeper: stakingKeeper,
authKeeper: authKeeper,
}
}
// Name returns the crosschain module's name.
func (am AppModule) Name() string {
return am.AppModuleBasic.Name()
}
// Route returns the crosschain module's message routing key.
func (am AppModule) Route() sdk.Route {
return sdk.Route{}
}
// QuerierRoute returns the crosschain module's query routing key.
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
// LegacyQuerierHandler returns the crosschain module's Querier.
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
m := keeper.NewMigrator(am.keeper)
if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil {
panic(err)
}
if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil {
panic(err)
}
}
// RegisterInvariants registers the crosschain module's invariants.
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// InitGenesis performs the crosschain module's genesis initialization It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate {
var genState types.GenesisState
// Initialize global index to index in genesis state
cdc.MustUnmarshalJSON(gs, &genState)
InitGenesis(ctx, am.keeper, genState)
// ensure account is created
am.authKeeper.GetModuleAccount(ctx, types.ModuleName)
return []abci.ValidatorUpdate{}
}
// ExportGenesis returns the crosschain module's exported genesis state as raw JSON bytes.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
genState := ExportGenesis(ctx, am.keeper)
return cdc.MustMarshalJSON(genState)
}
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 3 }
// BeginBlock executes all ABCI BeginBlock logic respective to the crosschain module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
if ctx.BlockHeight() == 200 {
err := am.keeper.TestWhitelistERC20(ctx)
if err != nil {
panic(err)
}
}
err := am.keeper.IterateAndUpdateCctxGasPrice(ctx)
if err != nil {
ctx.Logger().Error("Error iterating and updating pending cctx gas price", "err", err.Error())
}
}
// EndBlock executes all ABCI EndBlock logic respective to the crosschain module. It
// returns no validator updates.
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}
package crosschain
import (
"math/rand"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
// GenerateGenesisState creates a randomized GenState of the module
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
accs := make([]string, len(simState.Accounts))
for i, acc := range simState.Accounts {
accs[i] = acc.Address.String()
}
crosschainGenesis := types.GenesisState{
Params: types.DefaultParams(),
}
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&crosschainGenesis)
}
// ProposalContents doesn't return any content functions for governance proposals
func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent {
return nil
}
// RandomizedParams creates randomized param changes for the simulator
func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange {
return []simtypes.ParamChange{}
}
// RegisterStoreDecoder registers a decoder
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {}
// WeightedOperations returns the all the gov module operations with their respective weights.
func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
operations := make([]simtypes.WeightedOperation, 0)
return operations
}
package types
import (
"fmt"
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// GetCurrentOutTxParam returns the current outbound tx params.
// There can only be one active outtx.
// OutboundTxParams[0] is the original outtx, if it reverts, then
// OutboundTxParams[1] is the new outtx.
func (m CrossChainTx) GetCurrentOutTxParam() *OutboundTxParams {
if len(m.OutboundTxParams) == 0 {
return &OutboundTxParams{}
}
return m.OutboundTxParams[len(m.OutboundTxParams)-1]
}
// IsCurrentOutTxRevert returns true if the current outbound tx is the revert tx.
func (m CrossChainTx) IsCurrentOutTxRevert() bool {
return len(m.OutboundTxParams) == 2
}
// OriginalDestinationChainID returns the original destination of the outbound tx, reverted or not
// If there is no outbound tx, return -1
func (m CrossChainTx) OriginalDestinationChainID() int64 {
if len(m.OutboundTxParams) == 0 {
return -1
}
return m.OutboundTxParams[0].ReceiverChainId
}
// GetAllAuthzZetaclientTxTypes returns all the authz types for zetaclient
func GetAllAuthzZetaclientTxTypes() []string {
return []string{
sdk.MsgTypeURL(&MsgNonceVoter{}),
sdk.MsgTypeURL(&MsgGasPriceVoter{}),
sdk.MsgTypeURL(&MsgVoteOnObservedInboundTx{}),
sdk.MsgTypeURL(&MsgVoteOnObservedOutboundTx{}),
sdk.MsgTypeURL(&MsgSetNodeKeys{}),
sdk.MsgTypeURL(&MsgCreateTSSVoter{}),
sdk.MsgTypeURL(&MsgAddToOutTxTracker{}),
sdk.MsgTypeURL(&MsgSetNodeKeys{}),
sdk.MsgTypeURL(&observertypes.MsgAddBlameVote{}),
sdk.MsgTypeURL(&observertypes.MsgAddBlockHeader{}),
}
}
// GetGasPrice returns the gas price of the outbound tx
func (m OutboundTxParams) GetGasPrice() (uint64, error) {
gasPrice, err := strconv.ParseUint(m.OutboundTxGasPrice, 10, 64)
if err != nil {
return 0, fmt.Errorf("unable to parse cctx gas price %s: %s", m.OutboundTxGasPrice, err.Error())
}
return gasPrice, nil
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/chain_nonces.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ChainNonces struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Index string `protobuf:"bytes,2,opt,name=index,proto3" json:"index,omitempty"`
ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Nonce uint64 `protobuf:"varint,4,opt,name=nonce,proto3" json:"nonce,omitempty"`
Signers []string `protobuf:"bytes,5,rep,name=signers,proto3" json:"signers,omitempty"`
FinalizedHeight uint64 `protobuf:"varint,6,opt,name=finalizedHeight,proto3" json:"finalizedHeight,omitempty"`
}
func (m *ChainNonces) Reset() { *m = ChainNonces{} }
func (m *ChainNonces) String() string { return proto.CompactTextString(m) }
func (*ChainNonces) ProtoMessage() {}
func (*ChainNonces) Descriptor() ([]byte, []int) {
return fileDescriptor_c2dddd7805d88f2e, []int{0}
}
func (m *ChainNonces) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ChainNonces) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ChainNonces.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ChainNonces) XXX_Merge(src proto.Message) {
xxx_messageInfo_ChainNonces.Merge(m, src)
}
func (m *ChainNonces) XXX_Size() int {
return m.Size()
}
func (m *ChainNonces) XXX_DiscardUnknown() {
xxx_messageInfo_ChainNonces.DiscardUnknown(m)
}
var xxx_messageInfo_ChainNonces proto.InternalMessageInfo
func (m *ChainNonces) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *ChainNonces) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *ChainNonces) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *ChainNonces) GetNonce() uint64 {
if m != nil {
return m.Nonce
}
return 0
}
func (m *ChainNonces) GetSigners() []string {
if m != nil {
return m.Signers
}
return nil
}
func (m *ChainNonces) GetFinalizedHeight() uint64 {
if m != nil {
return m.FinalizedHeight
}
return 0
}
func init() {
proto.RegisterType((*ChainNonces)(nil), "zetachain.zetacore.crosschain.ChainNonces")
}
func init() { proto.RegisterFile("crosschain/chain_nonces.proto", fileDescriptor_c2dddd7805d88f2e) }
var fileDescriptor_c2dddd7805d88f2e = []byte{
// 266 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0x2e, 0xca, 0x2f,
0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x07, 0x93, 0xf1, 0x79, 0xf9, 0x79, 0xc9, 0xa9, 0xc5,
0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xb2, 0x55, 0xa9, 0x25, 0x89, 0x60, 0x71, 0x3d, 0x30,
0x2b, 0xbf, 0x28, 0x55, 0x0f, 0xa1, 0x43, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xac, 0x52, 0x1f,
0xc4, 0x82, 0x68, 0x52, 0xda, 0xc4, 0xc8, 0xc5, 0xed, 0x0c, 0x92, 0xf7, 0x03, 0x1b, 0x25, 0x24,
0xc1, 0xc5, 0x9e, 0x5c, 0x94, 0x9a, 0x58, 0x92, 0x5f, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19,
0x04, 0xe3, 0x0a, 0x89, 0x70, 0xb1, 0x66, 0xe6, 0xa5, 0xa4, 0x56, 0x48, 0x30, 0x81, 0xc5, 0x21,
0x1c, 0x21, 0x49, 0x2e, 0x0e, 0x88, 0x53, 0x32, 0x53, 0x24, 0x98, 0x15, 0x18, 0x35, 0x98, 0x83,
0xd8, 0xc1, 0x7c, 0xcf, 0x14, 0x90, 0x06, 0xb0, 0xfb, 0x24, 0x58, 0x14, 0x18, 0x35, 0x58, 0x82,
0x20, 0x1c, 0x90, 0x05, 0xc5, 0x99, 0xe9, 0x79, 0xa9, 0x45, 0xc5, 0x12, 0xac, 0x0a, 0xcc, 0x20,
0x0b, 0xa0, 0x5c, 0x21, 0x0d, 0x2e, 0xfe, 0xb4, 0xcc, 0xbc, 0xc4, 0x9c, 0xcc, 0xaa, 0xd4, 0x14,
0x8f, 0xd4, 0xcc, 0xf4, 0x8c, 0x12, 0x09, 0x36, 0xb0, 0x4e, 0x74, 0x61, 0x27, 0xef, 0x13, 0x8f,
0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b,
0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2,
0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x05, 0x82, 0x2e, 0x24, 0xb4, 0x60, 0xe1, 0xa1, 0x5f, 0xa1, 0x8f,
0x14, 0x86, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x80, 0x30, 0x06, 0x04, 0x00, 0x00,
0xff, 0xff, 0x69, 0x96, 0x2f, 0x81, 0x5e, 0x01, 0x00, 0x00,
}
func (m *ChainNonces) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ChainNonces) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ChainNonces) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.FinalizedHeight != 0 {
i = encodeVarintChainNonces(dAtA, i, uint64(m.FinalizedHeight))
i--
dAtA[i] = 0x30
}
if len(m.Signers) > 0 {
for iNdEx := len(m.Signers) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Signers[iNdEx])
copy(dAtA[i:], m.Signers[iNdEx])
i = encodeVarintChainNonces(dAtA, i, uint64(len(m.Signers[iNdEx])))
i--
dAtA[i] = 0x2a
}
}
if m.Nonce != 0 {
i = encodeVarintChainNonces(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x20
}
if m.ChainId != 0 {
i = encodeVarintChainNonces(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x18
}
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintChainNonces(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintChainNonces(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintChainNonces(dAtA []byte, offset int, v uint64) int {
offset -= sovChainNonces(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *ChainNonces) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovChainNonces(uint64(l))
}
l = len(m.Index)
if l > 0 {
n += 1 + l + sovChainNonces(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovChainNonces(uint64(m.ChainId))
}
if m.Nonce != 0 {
n += 1 + sovChainNonces(uint64(m.Nonce))
}
if len(m.Signers) > 0 {
for _, s := range m.Signers {
l = len(s)
n += 1 + l + sovChainNonces(uint64(l))
}
}
if m.FinalizedHeight != 0 {
n += 1 + sovChainNonces(uint64(m.FinalizedHeight))
}
return n
}
func sovChainNonces(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozChainNonces(x uint64) (n int) {
return sovChainNonces(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *ChainNonces) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChainNonces
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ChainNonces: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ChainNonces: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChainNonces
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthChainNonces
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthChainNonces
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChainNonces
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthChainNonces
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthChainNonces
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChainNonces
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChainNonces
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChainNonces
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthChainNonces
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthChainNonces
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signers = append(m.Signers, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field FinalizedHeight", wireType)
}
m.FinalizedHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChainNonces
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.FinalizedHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipChainNonces(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthChainNonces
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipChainNonces(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowChainNonces
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowChainNonces
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowChainNonces
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthChainNonces
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupChainNonces
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthChainNonces
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthChainNonces = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowChainNonces = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupChainNonces = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
"github.com/cosmos/cosmos-sdk/client"
)
var (
ClientCtx client.Context
)
func RegisterClientCtx(clientCtx client.Context) error {
ClientCtx = clientCtx
return nil
}
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgAddToOutTxTracker{}, "crosschain/AddToOutTxTracker", nil)
cdc.RegisterConcrete(&MsgAddToInTxTracker{}, "crosschain/AddToInTxTracker", nil)
cdc.RegisterConcrete(&MsgRemoveFromOutTxTracker{}, "crosschain/RemoveFromOutTxTracker", nil)
cdc.RegisterConcrete(&MsgCreateTSSVoter{}, "crosschain/CreateTSSVoter", nil)
cdc.RegisterConcrete(&MsgGasPriceVoter{}, "crosschain/GasPriceVoter", nil)
cdc.RegisterConcrete(&MsgNonceVoter{}, "crosschain/NonceVoter", nil)
cdc.RegisterConcrete(&MsgVoteOnObservedOutboundTx{}, "crosschain/VoteOnObservedOutboundTx", nil)
cdc.RegisterConcrete(&MsgVoteOnObservedInboundTx{}, "crosschain/VoteOnObservedInboundTx", nil)
cdc.RegisterConcrete(&MsgWhitelistERC20{}, "crosschain/WhitelistERC20", nil)
cdc.RegisterConcrete(&MsgMigrateTssFunds{}, "crosschain/MigrateTssFunds", nil)
cdc.RegisterConcrete(&MsgUpdateTssAddress{}, "crosschain/UpdateTssAddress", nil)
cdc.RegisterConcrete(&MsgSetNodeKeys{}, "crosschain/SetNodeKeys", nil)
}
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgAddToOutTxTracker{},
&MsgAddToInTxTracker{},
&MsgRemoveFromOutTxTracker{},
&MsgCreateTSSVoter{},
&MsgGasPriceVoter{},
&MsgNonceVoter{},
&MsgVoteOnObservedOutboundTx{},
&MsgVoteOnObservedInboundTx{},
&MsgWhitelistERC20{},
&MsgMigrateTssFunds{},
&MsgUpdateTssAddress{},
&MsgSetNodeKeys{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
var (
Amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/cross_chain_tx.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type CctxStatus int32
const (
CctxStatus_PendingInbound CctxStatus = 0
CctxStatus_PendingOutbound CctxStatus = 1
CctxStatus_OutboundMined CctxStatus = 3
CctxStatus_PendingRevert CctxStatus = 4
CctxStatus_Reverted CctxStatus = 5
CctxStatus_Aborted CctxStatus = 6
)
var CctxStatus_name = map[int32]string{
0: "PendingInbound",
1: "PendingOutbound",
3: "OutboundMined",
4: "PendingRevert",
5: "Reverted",
6: "Aborted",
}
var CctxStatus_value = map[string]int32{
"PendingInbound": 0,
"PendingOutbound": 1,
"OutboundMined": 3,
"PendingRevert": 4,
"Reverted": 5,
"Aborted": 6,
}
func (x CctxStatus) String() string {
return proto.EnumName(CctxStatus_name, int32(x))
}
func (CctxStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_af3a0ad055343c21, []int{0}
}
type InboundTxParams struct {
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
SenderChainId int64 `protobuf:"varint,2,opt,name=sender_chain_id,json=senderChainId,proto3" json:"sender_chain_id,omitempty"`
TxOrigin string `protobuf:"bytes,3,opt,name=tx_origin,json=txOrigin,proto3" json:"tx_origin,omitempty"`
CoinType common.CoinType `protobuf:"varint,4,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
Asset string `protobuf:"bytes,5,opt,name=asset,proto3" json:"asset,omitempty"`
Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"`
InboundTxObservedHash string `protobuf:"bytes,7,opt,name=inbound_tx_observed_hash,json=inboundTxObservedHash,proto3" json:"inbound_tx_observed_hash,omitempty"`
InboundTxObservedExternalHeight uint64 `protobuf:"varint,8,opt,name=inbound_tx_observed_external_height,json=inboundTxObservedExternalHeight,proto3" json:"inbound_tx_observed_external_height,omitempty"`
InboundTxBallotIndex string `protobuf:"bytes,9,opt,name=inbound_tx_ballot_index,json=inboundTxBallotIndex,proto3" json:"inbound_tx_ballot_index,omitempty"`
InboundTxFinalizedZetaHeight uint64 `protobuf:"varint,10,opt,name=inbound_tx_finalized_zeta_height,json=inboundTxFinalizedZetaHeight,proto3" json:"inbound_tx_finalized_zeta_height,omitempty"`
}
func (m *InboundTxParams) Reset() { *m = InboundTxParams{} }
func (m *InboundTxParams) String() string { return proto.CompactTextString(m) }
func (*InboundTxParams) ProtoMessage() {}
func (*InboundTxParams) Descriptor() ([]byte, []int) {
return fileDescriptor_af3a0ad055343c21, []int{0}
}
func (m *InboundTxParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *InboundTxParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_InboundTxParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *InboundTxParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_InboundTxParams.Merge(m, src)
}
func (m *InboundTxParams) XXX_Size() int {
return m.Size()
}
func (m *InboundTxParams) XXX_DiscardUnknown() {
xxx_messageInfo_InboundTxParams.DiscardUnknown(m)
}
var xxx_messageInfo_InboundTxParams proto.InternalMessageInfo
func (m *InboundTxParams) GetSender() string {
if m != nil {
return m.Sender
}
return ""
}
func (m *InboundTxParams) GetSenderChainId() int64 {
if m != nil {
return m.SenderChainId
}
return 0
}
func (m *InboundTxParams) GetTxOrigin() string {
if m != nil {
return m.TxOrigin
}
return ""
}
func (m *InboundTxParams) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *InboundTxParams) GetAsset() string {
if m != nil {
return m.Asset
}
return ""
}
func (m *InboundTxParams) GetInboundTxObservedHash() string {
if m != nil {
return m.InboundTxObservedHash
}
return ""
}
func (m *InboundTxParams) GetInboundTxObservedExternalHeight() uint64 {
if m != nil {
return m.InboundTxObservedExternalHeight
}
return 0
}
func (m *InboundTxParams) GetInboundTxBallotIndex() string {
if m != nil {
return m.InboundTxBallotIndex
}
return ""
}
func (m *InboundTxParams) GetInboundTxFinalizedZetaHeight() uint64 {
if m != nil {
return m.InboundTxFinalizedZetaHeight
}
return 0
}
type OutboundTxParams struct {
Receiver string `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"`
ReceiverChainId int64 `protobuf:"varint,2,opt,name=receiver_chainId,json=receiverChainId,proto3" json:"receiver_chainId,omitempty"`
CoinType common.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"`
OutboundTxTssNonce uint64 `protobuf:"varint,5,opt,name=outbound_tx_tss_nonce,json=outboundTxTssNonce,proto3" json:"outbound_tx_tss_nonce,omitempty"`
OutboundTxGasLimit uint64 `protobuf:"varint,6,opt,name=outbound_tx_gas_limit,json=outboundTxGasLimit,proto3" json:"outbound_tx_gas_limit,omitempty"`
OutboundTxGasPrice string `protobuf:"bytes,7,opt,name=outbound_tx_gas_price,json=outboundTxGasPrice,proto3" json:"outbound_tx_gas_price,omitempty"`
// the above are commands for zetaclients
// the following fields are used when the outbound tx is mined
OutboundTxHash string `protobuf:"bytes,8,opt,name=outbound_tx_hash,json=outboundTxHash,proto3" json:"outbound_tx_hash,omitempty"`
OutboundTxBallotIndex string `protobuf:"bytes,9,opt,name=outbound_tx_ballot_index,json=outboundTxBallotIndex,proto3" json:"outbound_tx_ballot_index,omitempty"`
OutboundTxObservedExternalHeight uint64 `protobuf:"varint,10,opt,name=outbound_tx_observed_external_height,json=outboundTxObservedExternalHeight,proto3" json:"outbound_tx_observed_external_height,omitempty"`
OutboundTxGasUsed uint64 `protobuf:"varint,20,opt,name=outbound_tx_gas_used,json=outboundTxGasUsed,proto3" json:"outbound_tx_gas_used,omitempty"`
OutboundTxEffectiveGasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,21,opt,name=outbound_tx_effective_gas_price,json=outboundTxEffectiveGasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"outbound_tx_effective_gas_price"`
OutboundTxEffectiveGasLimit uint64 `protobuf:"varint,22,opt,name=outbound_tx_effective_gas_limit,json=outboundTxEffectiveGasLimit,proto3" json:"outbound_tx_effective_gas_limit,omitempty"`
TssPubkey string `protobuf:"bytes,11,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"`
}
func (m *OutboundTxParams) Reset() { *m = OutboundTxParams{} }
func (m *OutboundTxParams) String() string { return proto.CompactTextString(m) }
func (*OutboundTxParams) ProtoMessage() {}
func (*OutboundTxParams) Descriptor() ([]byte, []int) {
return fileDescriptor_af3a0ad055343c21, []int{1}
}
func (m *OutboundTxParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *OutboundTxParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_OutboundTxParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *OutboundTxParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_OutboundTxParams.Merge(m, src)
}
func (m *OutboundTxParams) XXX_Size() int {
return m.Size()
}
func (m *OutboundTxParams) XXX_DiscardUnknown() {
xxx_messageInfo_OutboundTxParams.DiscardUnknown(m)
}
var xxx_messageInfo_OutboundTxParams proto.InternalMessageInfo
func (m *OutboundTxParams) GetReceiver() string {
if m != nil {
return m.Receiver
}
return ""
}
func (m *OutboundTxParams) GetReceiverChainId() int64 {
if m != nil {
return m.ReceiverChainId
}
return 0
}
func (m *OutboundTxParams) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *OutboundTxParams) GetOutboundTxTssNonce() uint64 {
if m != nil {
return m.OutboundTxTssNonce
}
return 0
}
func (m *OutboundTxParams) GetOutboundTxGasLimit() uint64 {
if m != nil {
return m.OutboundTxGasLimit
}
return 0
}
func (m *OutboundTxParams) GetOutboundTxGasPrice() string {
if m != nil {
return m.OutboundTxGasPrice
}
return ""
}
func (m *OutboundTxParams) GetOutboundTxHash() string {
if m != nil {
return m.OutboundTxHash
}
return ""
}
func (m *OutboundTxParams) GetOutboundTxBallotIndex() string {
if m != nil {
return m.OutboundTxBallotIndex
}
return ""
}
func (m *OutboundTxParams) GetOutboundTxObservedExternalHeight() uint64 {
if m != nil {
return m.OutboundTxObservedExternalHeight
}
return 0
}
func (m *OutboundTxParams) GetOutboundTxGasUsed() uint64 {
if m != nil {
return m.OutboundTxGasUsed
}
return 0
}
func (m *OutboundTxParams) GetOutboundTxEffectiveGasLimit() uint64 {
if m != nil {
return m.OutboundTxEffectiveGasLimit
}
return 0
}
func (m *OutboundTxParams) GetTssPubkey() string {
if m != nil {
return m.TssPubkey
}
return ""
}
type Status struct {
Status CctxStatus `protobuf:"varint,1,opt,name=status,proto3,enum=zetachain.zetacore.crosschain.CctxStatus" json:"status,omitempty"`
StatusMessage string `protobuf:"bytes,2,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"`
LastUpdateTimestamp int64 `protobuf:"varint,3,opt,name=lastUpdate_timestamp,json=lastUpdateTimestamp,proto3" json:"lastUpdate_timestamp,omitempty"`
}
func (m *Status) Reset() { *m = Status{} }
func (m *Status) String() string { return proto.CompactTextString(m) }
func (*Status) ProtoMessage() {}
func (*Status) Descriptor() ([]byte, []int) {
return fileDescriptor_af3a0ad055343c21, []int{2}
}
func (m *Status) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Status.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Status) XXX_Merge(src proto.Message) {
xxx_messageInfo_Status.Merge(m, src)
}
func (m *Status) XXX_Size() int {
return m.Size()
}
func (m *Status) XXX_DiscardUnknown() {
xxx_messageInfo_Status.DiscardUnknown(m)
}
var xxx_messageInfo_Status proto.InternalMessageInfo
func (m *Status) GetStatus() CctxStatus {
if m != nil {
return m.Status
}
return CctxStatus_PendingInbound
}
func (m *Status) GetStatusMessage() string {
if m != nil {
return m.StatusMessage
}
return ""
}
func (m *Status) GetLastUpdateTimestamp() int64 {
if m != nil {
return m.LastUpdateTimestamp
}
return 0
}
type CrossChainTx struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Index string `protobuf:"bytes,2,opt,name=index,proto3" json:"index,omitempty"`
ZetaFees github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,5,opt,name=zeta_fees,json=zetaFees,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"zeta_fees" yaml:"zeta_fees"`
RelayedMessage string `protobuf:"bytes,6,opt,name=relayed_message,json=relayedMessage,proto3" json:"relayed_message,omitempty"`
CctxStatus *Status `protobuf:"bytes,8,opt,name=cctx_status,json=cctxStatus,proto3" json:"cctx_status,omitempty"`
InboundTxParams *InboundTxParams `protobuf:"bytes,9,opt,name=inbound_tx_params,json=inboundTxParams,proto3" json:"inbound_tx_params,omitempty"`
OutboundTxParams []*OutboundTxParams `protobuf:"bytes,10,rep,name=outbound_tx_params,json=outboundTxParams,proto3" json:"outbound_tx_params,omitempty"`
}
func (m *CrossChainTx) Reset() { *m = CrossChainTx{} }
func (m *CrossChainTx) String() string { return proto.CompactTextString(m) }
func (*CrossChainTx) ProtoMessage() {}
func (*CrossChainTx) Descriptor() ([]byte, []int) {
return fileDescriptor_af3a0ad055343c21, []int{3}
}
func (m *CrossChainTx) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *CrossChainTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_CrossChainTx.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *CrossChainTx) XXX_Merge(src proto.Message) {
xxx_messageInfo_CrossChainTx.Merge(m, src)
}
func (m *CrossChainTx) XXX_Size() int {
return m.Size()
}
func (m *CrossChainTx) XXX_DiscardUnknown() {
xxx_messageInfo_CrossChainTx.DiscardUnknown(m)
}
var xxx_messageInfo_CrossChainTx proto.InternalMessageInfo
func (m *CrossChainTx) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *CrossChainTx) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *CrossChainTx) GetRelayedMessage() string {
if m != nil {
return m.RelayedMessage
}
return ""
}
func (m *CrossChainTx) GetCctxStatus() *Status {
if m != nil {
return m.CctxStatus
}
return nil
}
func (m *CrossChainTx) GetInboundTxParams() *InboundTxParams {
if m != nil {
return m.InboundTxParams
}
return nil
}
func (m *CrossChainTx) GetOutboundTxParams() []*OutboundTxParams {
if m != nil {
return m.OutboundTxParams
}
return nil
}
func init() {
proto.RegisterEnum("zetachain.zetacore.crosschain.CctxStatus", CctxStatus_name, CctxStatus_value)
proto.RegisterType((*InboundTxParams)(nil), "zetachain.zetacore.crosschain.InboundTxParams")
proto.RegisterType((*OutboundTxParams)(nil), "zetachain.zetacore.crosschain.OutboundTxParams")
proto.RegisterType((*Status)(nil), "zetachain.zetacore.crosschain.Status")
proto.RegisterType((*CrossChainTx)(nil), "zetachain.zetacore.crosschain.CrossChainTx")
}
func init() { proto.RegisterFile("crosschain/cross_chain_tx.proto", fileDescriptor_af3a0ad055343c21) }
var fileDescriptor_af3a0ad055343c21 = []byte{
// 1003 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x4e, 0x1b, 0xc7,
0x17, 0x67, 0xff, 0x36, 0xc6, 0x3e, 0x0e, 0x78, 0x19, 0x4c, 0xfe, 0x2b, 0xd2, 0xd8, 0x96, 0xdb,
0x24, 0x4e, 0x25, 0x6c, 0x41, 0x55, 0x45, 0xea, 0x5d, 0xa0, 0x21, 0x41, 0x4d, 0x02, 0xda, 0xc2,
0x0d, 0x52, 0xb5, 0x1d, 0xef, 0x1e, 0xec, 0x51, 0xec, 0x1d, 0x6b, 0x67, 0x8c, 0x96, 0xa8, 0x57,
0x7d, 0x82, 0x3e, 0x44, 0x2b, 0xb5, 0x6f, 0x92, 0x8b, 0x5e, 0xe4, 0xb2, 0xea, 0x05, 0xaa, 0xe0,
0x0d, 0xfa, 0x04, 0xd5, 0xcc, 0xec, 0xda, 0x6b, 0x17, 0x42, 0xab, 0x5e, 0xf9, 0x7c, 0xcc, 0xef,
0xcc, 0xf9, 0xf8, 0x9d, 0xf1, 0x42, 0xdd, 0x8f, 0xb8, 0x10, 0x7e, 0x9f, 0xb2, 0xb0, 0xa3, 0x45,
0x4f, 0xcb, 0x9e, 0x8c, 0xdb, 0xa3, 0x88, 0x4b, 0x4e, 0xee, 0xbf, 0x45, 0x49, 0xb5, 0xad, 0xad,
0x25, 0x1e, 0x61, 0x7b, 0x8a, 0xd9, 0x58, 0xf3, 0xf9, 0x70, 0xc8, 0xc3, 0x8e, 0xf9, 0x31, 0x98,
0x8d, 0x6a, 0x8f, 0xf7, 0xb8, 0x16, 0x3b, 0x4a, 0x32, 0xd6, 0xe6, 0xf7, 0x79, 0xa8, 0xec, 0x87,
0x5d, 0x3e, 0x0e, 0x83, 0xa3, 0xf8, 0x90, 0x46, 0x74, 0x28, 0xc8, 0x5d, 0x28, 0x08, 0x0c, 0x03,
0x8c, 0x1c, 0xab, 0x61, 0xb5, 0x4a, 0x6e, 0xa2, 0x91, 0x87, 0x50, 0x31, 0x52, 0x92, 0x0e, 0x0b,
0x9c, 0xff, 0x35, 0xac, 0x56, 0xce, 0x5d, 0x36, 0xe6, 0x5d, 0x65, 0xdd, 0x0f, 0xc8, 0x3d, 0x28,
0xc9, 0xd8, 0xe3, 0x11, 0xeb, 0xb1, 0xd0, 0xc9, 0xe9, 0x10, 0x45, 0x19, 0x1f, 0x68, 0x9d, 0x6c,
0x42, 0xc9, 0xe7, 0xaa, 0x96, 0xf3, 0x11, 0x3a, 0xf9, 0x86, 0xd5, 0x5a, 0xd9, 0xb6, 0xdb, 0x49,
0xa2, 0xbb, 0x9c, 0x85, 0x47, 0xe7, 0x23, 0x74, 0x8b, 0x7e, 0x22, 0x91, 0x2a, 0x2c, 0x52, 0x21,
0x50, 0x3a, 0x8b, 0x3a, 0x8e, 0x51, 0xc8, 0x73, 0x28, 0xd0, 0x21, 0x1f, 0x87, 0xd2, 0x29, 0x28,
0xf3, 0x4e, 0xe7, 0xdd, 0x45, 0x7d, 0xe1, 0xf7, 0x8b, 0xfa, 0xa3, 0x1e, 0x93, 0xfd, 0x71, 0x57,
0xc5, 0xeb, 0xf8, 0x5c, 0x0c, 0xb9, 0x48, 0x7e, 0x36, 0x45, 0xf0, 0xa6, 0xa3, 0xae, 0x14, 0xed,
0x63, 0x16, 0x4a, 0x37, 0x81, 0x93, 0x27, 0xe0, 0x30, 0x53, 0xbd, 0xa7, 0x52, 0xee, 0x0a, 0x8c,
0xce, 0x30, 0xf0, 0xfa, 0x54, 0xf4, 0x9d, 0x25, 0x7d, 0xe3, 0x3a, 0x4b, 0xbb, 0x73, 0x90, 0x78,
0x5f, 0x50, 0xd1, 0x27, 0x2f, 0xe1, 0xe3, 0xeb, 0x80, 0x18, 0x4b, 0x8c, 0x42, 0x3a, 0xf0, 0xfa,
0xc8, 0x7a, 0x7d, 0xe9, 0x14, 0x1b, 0x56, 0x2b, 0xef, 0xd6, 0xff, 0x16, 0xe3, 0x59, 0x72, 0xee,
0x85, 0x3e, 0x46, 0x3e, 0x87, 0xff, 0x67, 0xa2, 0x75, 0xe9, 0x60, 0xc0, 0xa5, 0xc7, 0xc2, 0x00,
0x63, 0xa7, 0xa4, 0xb3, 0xa8, 0x4e, 0x22, 0xec, 0x68, 0xe7, 0xbe, 0xf2, 0x91, 0x3d, 0x68, 0x64,
0x60, 0xa7, 0x2c, 0xa4, 0x03, 0xf6, 0x16, 0x03, 0x4f, 0x71, 0x22, 0xcd, 0x00, 0x74, 0x06, 0x1f,
0x4d, 0xf0, 0x7b, 0xe9, 0xa9, 0x13, 0x94, 0xd4, 0x5c, 0xdf, 0xfc, 0xa5, 0x00, 0xf6, 0xc1, 0x58,
0xce, 0xb2, 0x60, 0x03, 0x8a, 0x11, 0xfa, 0xc8, 0xce, 0x26, 0x3c, 0x98, 0xe8, 0xe4, 0x31, 0xd8,
0xa9, 0x6c, 0xb8, 0xb0, 0x9f, 0x52, 0xa1, 0x92, 0xda, 0x53, 0x32, 0xcc, 0xcc, 0x3b, 0x77, 0xeb,
0xbc, 0xa7, 0x93, 0xcd, 0xff, 0xb7, 0xc9, 0x6e, 0xc1, 0x3a, 0x4f, 0x4a, 0x52, 0xcd, 0x91, 0x42,
0x78, 0x21, 0x0f, 0x7d, 0xd4, 0x44, 0xca, 0xbb, 0x84, 0x4f, 0xea, 0x3d, 0x12, 0xe2, 0xb5, 0xf2,
0xcc, 0x43, 0x7a, 0x54, 0x78, 0x03, 0x36, 0x64, 0x86, 0x64, 0x33, 0x90, 0xe7, 0x54, 0xbc, 0x54,
0x9e, 0xeb, 0x20, 0xa3, 0x88, 0xf9, 0x98, 0x90, 0x67, 0x16, 0x72, 0xa8, 0x3c, 0xa4, 0x05, 0x76,
0x16, 0xa2, 0xa9, 0x56, 0xd4, 0xa7, 0x57, 0xa6, 0xa7, 0x35, 0xc7, 0x9e, 0x80, 0x93, 0x3d, 0x79,
0x0d, 0x2d, 0xd6, 0xa7, 0x88, 0x2c, 0x2f, 0x5e, 0xc3, 0x27, 0x59, 0xe0, 0x8d, 0xec, 0x34, 0xdc,
0x68, 0x4c, 0x83, 0xdc, 0x40, 0xcf, 0x0e, 0x54, 0xe7, 0xab, 0x1c, 0x0b, 0x0c, 0x9c, 0xaa, 0xc6,
0xaf, 0xce, 0x14, 0x79, 0x2c, 0x30, 0x20, 0x12, 0xea, 0x59, 0x00, 0x9e, 0x9e, 0xa2, 0x2f, 0xd9,
0x19, 0x66, 0x1a, 0xb4, 0xae, 0xc7, 0xdb, 0x4e, 0xc6, 0xfb, 0xf0, 0x1f, 0x8c, 0x77, 0x3f, 0x94,
0xee, 0xbd, 0xe9, 0x5d, 0xcf, 0xd2, 0xa0, 0x93, 0xce, 0x7e, 0xf9, 0xa1, 0x5b, 0xcd, 0x24, 0xef,
0xea, 0x8c, 0x6f, 0x88, 0x62, 0x46, 0x7a, 0x1f, 0x40, 0x91, 0x65, 0x34, 0xee, 0xbe, 0xc1, 0x73,
0xa7, 0xac, 0xfb, 0x5c, 0x92, 0x42, 0x1c, 0x6a, 0x43, 0xf3, 0x27, 0x0b, 0x0a, 0x5f, 0x4b, 0x2a,
0xc7, 0x82, 0x3c, 0x85, 0x82, 0xd0, 0x92, 0xde, 0x8f, 0x95, 0xed, 0xc7, 0xed, 0x0f, 0x3e, 0xcb,
0xed, 0x5d, 0x5f, 0xc6, 0x06, 0xea, 0x26, 0x40, 0xf2, 0x00, 0x56, 0x8c, 0xe4, 0x0d, 0x51, 0x08,
0xda, 0x43, 0xbd, 0x46, 0x25, 0x77, 0xd9, 0x58, 0x5f, 0x19, 0x23, 0xd9, 0x82, 0xea, 0x80, 0x0a,
0x79, 0x3c, 0x0a, 0xa8, 0x44, 0x4f, 0xb2, 0x21, 0x0a, 0x49, 0x87, 0x23, 0xbd, 0x4f, 0x39, 0x77,
0x6d, 0xea, 0x3b, 0x4a, 0x5d, 0xcd, 0x5f, 0x73, 0x70, 0x67, 0x57, 0xdd, 0xad, 0x17, 0xf1, 0x28,
0x26, 0x0e, 0x2c, 0xf9, 0x11, 0x52, 0xc9, 0xd3, 0x75, 0x4e, 0x55, 0xf5, 0xc6, 0x1a, 0x52, 0x99,
0xbb, 0x8d, 0x42, 0xbe, 0x85, 0x92, 0x7e, 0x47, 0x4e, 0x11, 0x85, 0x79, 0x7d, 0x77, 0x76, 0xff,
0xe5, 0x32, 0xfe, 0x79, 0x51, 0xb7, 0xcf, 0xe9, 0x70, 0xf0, 0x45, 0x73, 0x12, 0xa9, 0xe9, 0x16,
0x95, 0xbc, 0x87, 0x28, 0xc8, 0x23, 0xa8, 0x44, 0x38, 0xa0, 0xe7, 0x18, 0x4c, 0xaa, 0x2f, 0x98,
0x45, 0x48, 0xcc, 0x69, 0xf9, 0x7b, 0x50, 0xf6, 0x7d, 0x19, 0x7b, 0x49, 0xb7, 0xd5, 0xb6, 0x94,
0xb7, 0x1f, 0xdc, 0xd2, 0xed, 0xa4, 0xd3, 0xe0, 0x4f, 0xba, 0x4e, 0x4e, 0x60, 0x35, 0xf3, 0x5e,
0x8e, 0xf4, 0x3b, 0xa7, 0x37, 0xa9, 0xbc, 0xdd, 0xbe, 0x25, 0xda, 0xdc, 0x7f, 0xa4, 0x5b, 0x61,
0x73, 0x7f, 0x9a, 0xdf, 0x00, 0xc9, 0x92, 0x2f, 0x09, 0x0e, 0x8d, 0x5c, 0xab, 0xbc, 0xdd, 0xb9,
0x25, 0xf8, 0xfc, 0xdb, 0xeb, 0xda, 0x7c, 0xce, 0xf2, 0xe9, 0x77, 0x00, 0x53, 0xfa, 0x10, 0x02,
0x2b, 0x87, 0x18, 0x06, 0x2c, 0xec, 0x25, 0x79, 0xd9, 0x0b, 0x64, 0x0d, 0x2a, 0x89, 0x2d, 0x0d,
0x67, 0x5b, 0x64, 0x15, 0x96, 0x53, 0xed, 0x15, 0x0b, 0x31, 0xb0, 0x73, 0xca, 0x94, 0x9c, 0x73,
0xf1, 0x0c, 0x23, 0x69, 0xe7, 0xc9, 0x1d, 0x28, 0x1a, 0x19, 0x03, 0x7b, 0x91, 0x94, 0x61, 0xe9,
0x69, 0x97, 0x6b, 0xa5, 0xb0, 0x91, 0xff, 0xf9, 0xc7, 0x9a, 0xb5, 0xf3, 0xd5, 0xbb, 0xcb, 0x9a,
0xf5, 0xfe, 0xb2, 0x66, 0xfd, 0x71, 0x59, 0xb3, 0x7e, 0xb8, 0xaa, 0x2d, 0xbc, 0xbf, 0xaa, 0x2d,
0xfc, 0x76, 0x55, 0x5b, 0x38, 0xd9, 0xca, 0x50, 0x41, 0x95, 0xb6, 0x69, 0xbe, 0x5a, 0xd2, 0x2a,
0x3b, 0x71, 0x27, 0xf3, 0x2d, 0xa3, 0x99, 0xd1, 0x2d, 0xe8, 0x2f, 0x8f, 0xcf, 0xfe, 0x0a, 0x00,
0x00, 0xff, 0xff, 0x46, 0x27, 0x16, 0x29, 0xe6, 0x08, 0x00, 0x00,
}
func (m *InboundTxParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *InboundTxParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *InboundTxParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.InboundTxFinalizedZetaHeight != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.InboundTxFinalizedZetaHeight))
i--
dAtA[i] = 0x50
}
if len(m.InboundTxBallotIndex) > 0 {
i -= len(m.InboundTxBallotIndex)
copy(dAtA[i:], m.InboundTxBallotIndex)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.InboundTxBallotIndex)))
i--
dAtA[i] = 0x4a
}
if m.InboundTxObservedExternalHeight != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.InboundTxObservedExternalHeight))
i--
dAtA[i] = 0x40
}
if len(m.InboundTxObservedHash) > 0 {
i -= len(m.InboundTxObservedHash)
copy(dAtA[i:], m.InboundTxObservedHash)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.InboundTxObservedHash)))
i--
dAtA[i] = 0x3a
}
{
size := m.Amount.Size()
i -= size
if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintCrossChainTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if len(m.Asset) > 0 {
i -= len(m.Asset)
copy(dAtA[i:], m.Asset)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.Asset)))
i--
dAtA[i] = 0x2a
}
if m.CoinType != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x20
}
if len(m.TxOrigin) > 0 {
i -= len(m.TxOrigin)
copy(dAtA[i:], m.TxOrigin)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.TxOrigin)))
i--
dAtA[i] = 0x1a
}
if m.SenderChainId != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.SenderChainId))
i--
dAtA[i] = 0x10
}
if len(m.Sender) > 0 {
i -= len(m.Sender)
copy(dAtA[i:], m.Sender)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.Sender)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *OutboundTxParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *OutboundTxParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *OutboundTxParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.OutboundTxEffectiveGasLimit != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.OutboundTxEffectiveGasLimit))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0xb0
}
{
size := m.OutboundTxEffectiveGasPrice.Size()
i -= size
if _, err := m.OutboundTxEffectiveGasPrice.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintCrossChainTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0xaa
if m.OutboundTxGasUsed != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.OutboundTxGasUsed))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0xa0
}
if len(m.TssPubkey) > 0 {
i -= len(m.TssPubkey)
copy(dAtA[i:], m.TssPubkey)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.TssPubkey)))
i--
dAtA[i] = 0x5a
}
if m.OutboundTxObservedExternalHeight != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.OutboundTxObservedExternalHeight))
i--
dAtA[i] = 0x50
}
if len(m.OutboundTxBallotIndex) > 0 {
i -= len(m.OutboundTxBallotIndex)
copy(dAtA[i:], m.OutboundTxBallotIndex)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.OutboundTxBallotIndex)))
i--
dAtA[i] = 0x4a
}
if len(m.OutboundTxHash) > 0 {
i -= len(m.OutboundTxHash)
copy(dAtA[i:], m.OutboundTxHash)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.OutboundTxHash)))
i--
dAtA[i] = 0x42
}
if len(m.OutboundTxGasPrice) > 0 {
i -= len(m.OutboundTxGasPrice)
copy(dAtA[i:], m.OutboundTxGasPrice)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.OutboundTxGasPrice)))
i--
dAtA[i] = 0x3a
}
if m.OutboundTxGasLimit != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.OutboundTxGasLimit))
i--
dAtA[i] = 0x30
}
if m.OutboundTxTssNonce != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.OutboundTxTssNonce))
i--
dAtA[i] = 0x28
}
{
size := m.Amount.Size()
i -= size
if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintCrossChainTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if m.CoinType != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x18
}
if m.ReceiverChainId != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.ReceiverChainId))
i--
dAtA[i] = 0x10
}
if len(m.Receiver) > 0 {
i -= len(m.Receiver)
copy(dAtA[i:], m.Receiver)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.Receiver)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Status) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Status) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.LastUpdateTimestamp != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.LastUpdateTimestamp))
i--
dAtA[i] = 0x18
}
if len(m.StatusMessage) > 0 {
i -= len(m.StatusMessage)
copy(dAtA[i:], m.StatusMessage)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.StatusMessage)))
i--
dAtA[i] = 0x12
}
if m.Status != 0 {
i = encodeVarintCrossChainTx(dAtA, i, uint64(m.Status))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *CrossChainTx) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CrossChainTx) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CrossChainTx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.OutboundTxParams) > 0 {
for iNdEx := len(m.OutboundTxParams) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.OutboundTxParams[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCrossChainTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x52
}
}
if m.InboundTxParams != nil {
{
size, err := m.InboundTxParams.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCrossChainTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x4a
}
if m.CctxStatus != nil {
{
size, err := m.CctxStatus.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCrossChainTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
}
if len(m.RelayedMessage) > 0 {
i -= len(m.RelayedMessage)
copy(dAtA[i:], m.RelayedMessage)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.RelayedMessage)))
i--
dAtA[i] = 0x32
}
{
size := m.ZetaFees.Size()
i -= size
if _, err := m.ZetaFees.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintCrossChainTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintCrossChainTx(dAtA []byte, offset int, v uint64) int {
offset -= sovCrossChainTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *InboundTxParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Sender)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.SenderChainId != 0 {
n += 1 + sovCrossChainTx(uint64(m.SenderChainId))
}
l = len(m.TxOrigin)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.CoinType != 0 {
n += 1 + sovCrossChainTx(uint64(m.CoinType))
}
l = len(m.Asset)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
l = m.Amount.Size()
n += 1 + l + sovCrossChainTx(uint64(l))
l = len(m.InboundTxObservedHash)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.InboundTxObservedExternalHeight != 0 {
n += 1 + sovCrossChainTx(uint64(m.InboundTxObservedExternalHeight))
}
l = len(m.InboundTxBallotIndex)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.InboundTxFinalizedZetaHeight != 0 {
n += 1 + sovCrossChainTx(uint64(m.InboundTxFinalizedZetaHeight))
}
return n
}
func (m *OutboundTxParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Receiver)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.ReceiverChainId != 0 {
n += 1 + sovCrossChainTx(uint64(m.ReceiverChainId))
}
if m.CoinType != 0 {
n += 1 + sovCrossChainTx(uint64(m.CoinType))
}
l = m.Amount.Size()
n += 1 + l + sovCrossChainTx(uint64(l))
if m.OutboundTxTssNonce != 0 {
n += 1 + sovCrossChainTx(uint64(m.OutboundTxTssNonce))
}
if m.OutboundTxGasLimit != 0 {
n += 1 + sovCrossChainTx(uint64(m.OutboundTxGasLimit))
}
l = len(m.OutboundTxGasPrice)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
l = len(m.OutboundTxHash)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
l = len(m.OutboundTxBallotIndex)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.OutboundTxObservedExternalHeight != 0 {
n += 1 + sovCrossChainTx(uint64(m.OutboundTxObservedExternalHeight))
}
l = len(m.TssPubkey)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.OutboundTxGasUsed != 0 {
n += 2 + sovCrossChainTx(uint64(m.OutboundTxGasUsed))
}
l = m.OutboundTxEffectiveGasPrice.Size()
n += 2 + l + sovCrossChainTx(uint64(l))
if m.OutboundTxEffectiveGasLimit != 0 {
n += 2 + sovCrossChainTx(uint64(m.OutboundTxEffectiveGasLimit))
}
return n
}
func (m *Status) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Status != 0 {
n += 1 + sovCrossChainTx(uint64(m.Status))
}
l = len(m.StatusMessage)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.LastUpdateTimestamp != 0 {
n += 1 + sovCrossChainTx(uint64(m.LastUpdateTimestamp))
}
return n
}
func (m *CrossChainTx) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
l = len(m.Index)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
l = m.ZetaFees.Size()
n += 1 + l + sovCrossChainTx(uint64(l))
l = len(m.RelayedMessage)
if l > 0 {
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.CctxStatus != nil {
l = m.CctxStatus.Size()
n += 1 + l + sovCrossChainTx(uint64(l))
}
if m.InboundTxParams != nil {
l = m.InboundTxParams.Size()
n += 1 + l + sovCrossChainTx(uint64(l))
}
if len(m.OutboundTxParams) > 0 {
for _, e := range m.OutboundTxParams {
l = e.Size()
n += 1 + l + sovCrossChainTx(uint64(l))
}
}
return n
}
func sovCrossChainTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozCrossChainTx(x uint64) (n int) {
return sovCrossChainTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *InboundTxParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: InboundTxParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: InboundTxParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Sender = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field SenderChainId", wireType)
}
m.SenderChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.SenderChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxOrigin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxOrigin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Asset = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InboundTxObservedHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InboundTxObservedHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field InboundTxObservedExternalHeight", wireType)
}
m.InboundTxObservedExternalHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.InboundTxObservedExternalHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InboundTxBallotIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InboundTxBallotIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field InboundTxFinalizedZetaHeight", wireType)
}
m.InboundTxFinalizedZetaHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.InboundTxFinalizedZetaHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipCrossChainTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrossChainTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *OutboundTxParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: OutboundTxParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: OutboundTxParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Receiver = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ReceiverChainId", wireType)
}
m.ReceiverChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ReceiverChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxTssNonce", wireType)
}
m.OutboundTxTssNonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutboundTxTssNonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxGasLimit", wireType)
}
m.OutboundTxGasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutboundTxGasLimit |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxGasPrice", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutboundTxGasPrice = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutboundTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxBallotIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutboundTxBallotIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxObservedExternalHeight", wireType)
}
m.OutboundTxObservedExternalHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutboundTxObservedExternalHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssPubkey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 20:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxGasUsed", wireType)
}
m.OutboundTxGasUsed = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutboundTxGasUsed |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 21:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxEffectiveGasPrice", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.OutboundTxEffectiveGasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 22:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxEffectiveGasLimit", wireType)
}
m.OutboundTxEffectiveGasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutboundTxEffectiveGasLimit |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipCrossChainTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrossChainTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Status) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Status: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Status: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
m.Status = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Status |= CctxStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field StatusMessage", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.StatusMessage = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastUpdateTimestamp", wireType)
}
m.LastUpdateTimestamp = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LastUpdateTimestamp |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipCrossChainTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrossChainTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *CrossChainTx) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: CrossChainTx: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: CrossChainTx: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ZetaFees", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ZetaFees.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RelayedMessage", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.RelayedMessage = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxStatus", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.CctxStatus == nil {
m.CctxStatus = &Status{}
}
if err := m.CctxStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InboundTxParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.InboundTxParams == nil {
m.InboundTxParams = &InboundTxParams{}
}
if err := m.InboundTxParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCrossChainTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCrossChainTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutboundTxParams = append(m.OutboundTxParams, &OutboundTxParams{})
if err := m.OutboundTxParams[len(m.OutboundTxParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCrossChainTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrossChainTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipCrossChainTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCrossChainTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthCrossChainTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupCrossChainTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthCrossChainTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthCrossChainTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowCrossChainTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupCrossChainTx = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/events.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
_ "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type EventInboundFinalized struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"`
TxOrgin string `protobuf:"bytes,4,opt,name=tx_orgin,json=txOrgin,proto3" json:"tx_orgin,omitempty"`
Asset string `protobuf:"bytes,5,opt,name=asset,proto3" json:"asset,omitempty"`
InTxHash string `protobuf:"bytes,6,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"`
InBlockHeight string `protobuf:"bytes,7,opt,name=in_block_height,json=inBlockHeight,proto3" json:"in_block_height,omitempty"`
Receiver string `protobuf:"bytes,8,opt,name=receiver,proto3" json:"receiver,omitempty"`
ReceiverChain string `protobuf:"bytes,9,opt,name=receiver_chain,json=receiverChain,proto3" json:"receiver_chain,omitempty"`
Amount string `protobuf:"bytes,10,opt,name=amount,proto3" json:"amount,omitempty"`
RelayedMessage string `protobuf:"bytes,11,opt,name=relayed_message,json=relayedMessage,proto3" json:"relayed_message,omitempty"`
NewStatus string `protobuf:"bytes,12,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
StatusMessage string `protobuf:"bytes,13,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"`
SenderChain string `protobuf:"bytes,14,opt,name=sender_chain,json=senderChain,proto3" json:"sender_chain,omitempty"`
}
func (m *EventInboundFinalized) Reset() { *m = EventInboundFinalized{} }
func (m *EventInboundFinalized) String() string { return proto.CompactTextString(m) }
func (*EventInboundFinalized) ProtoMessage() {}
func (*EventInboundFinalized) Descriptor() ([]byte, []int) {
return fileDescriptor_7398db8b12b87b9e, []int{0}
}
func (m *EventInboundFinalized) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventInboundFinalized) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventInboundFinalized.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventInboundFinalized) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventInboundFinalized.Merge(m, src)
}
func (m *EventInboundFinalized) XXX_Size() int {
return m.Size()
}
func (m *EventInboundFinalized) XXX_DiscardUnknown() {
xxx_messageInfo_EventInboundFinalized.DiscardUnknown(m)
}
var xxx_messageInfo_EventInboundFinalized proto.InternalMessageInfo
func (m *EventInboundFinalized) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventInboundFinalized) GetCctxIndex() string {
if m != nil {
return m.CctxIndex
}
return ""
}
func (m *EventInboundFinalized) GetSender() string {
if m != nil {
return m.Sender
}
return ""
}
func (m *EventInboundFinalized) GetTxOrgin() string {
if m != nil {
return m.TxOrgin
}
return ""
}
func (m *EventInboundFinalized) GetAsset() string {
if m != nil {
return m.Asset
}
return ""
}
func (m *EventInboundFinalized) GetInTxHash() string {
if m != nil {
return m.InTxHash
}
return ""
}
func (m *EventInboundFinalized) GetInBlockHeight() string {
if m != nil {
return m.InBlockHeight
}
return ""
}
func (m *EventInboundFinalized) GetReceiver() string {
if m != nil {
return m.Receiver
}
return ""
}
func (m *EventInboundFinalized) GetReceiverChain() string {
if m != nil {
return m.ReceiverChain
}
return ""
}
func (m *EventInboundFinalized) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
func (m *EventInboundFinalized) GetRelayedMessage() string {
if m != nil {
return m.RelayedMessage
}
return ""
}
func (m *EventInboundFinalized) GetNewStatus() string {
if m != nil {
return m.NewStatus
}
return ""
}
func (m *EventInboundFinalized) GetStatusMessage() string {
if m != nil {
return m.StatusMessage
}
return ""
}
func (m *EventInboundFinalized) GetSenderChain() string {
if m != nil {
return m.SenderChain
}
return ""
}
type EventZrcWithdrawCreated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"`
SenderChain string `protobuf:"bytes,4,opt,name=sender_chain,json=senderChain,proto3" json:"sender_chain,omitempty"`
InTxHash string `protobuf:"bytes,5,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"`
Receiver string `protobuf:"bytes,6,opt,name=receiver,proto3" json:"receiver,omitempty"`
ReceiverChain string `protobuf:"bytes,7,opt,name=receiver_chain,json=receiverChain,proto3" json:"receiver_chain,omitempty"`
Amount string `protobuf:"bytes,8,opt,name=amount,proto3" json:"amount,omitempty"`
NewStatus string `protobuf:"bytes,9,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
}
func (m *EventZrcWithdrawCreated) Reset() { *m = EventZrcWithdrawCreated{} }
func (m *EventZrcWithdrawCreated) String() string { return proto.CompactTextString(m) }
func (*EventZrcWithdrawCreated) ProtoMessage() {}
func (*EventZrcWithdrawCreated) Descriptor() ([]byte, []int) {
return fileDescriptor_7398db8b12b87b9e, []int{1}
}
func (m *EventZrcWithdrawCreated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventZrcWithdrawCreated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventZrcWithdrawCreated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventZrcWithdrawCreated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventZrcWithdrawCreated.Merge(m, src)
}
func (m *EventZrcWithdrawCreated) XXX_Size() int {
return m.Size()
}
func (m *EventZrcWithdrawCreated) XXX_DiscardUnknown() {
xxx_messageInfo_EventZrcWithdrawCreated.DiscardUnknown(m)
}
var xxx_messageInfo_EventZrcWithdrawCreated proto.InternalMessageInfo
func (m *EventZrcWithdrawCreated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventZrcWithdrawCreated) GetCctxIndex() string {
if m != nil {
return m.CctxIndex
}
return ""
}
func (m *EventZrcWithdrawCreated) GetSender() string {
if m != nil {
return m.Sender
}
return ""
}
func (m *EventZrcWithdrawCreated) GetSenderChain() string {
if m != nil {
return m.SenderChain
}
return ""
}
func (m *EventZrcWithdrawCreated) GetInTxHash() string {
if m != nil {
return m.InTxHash
}
return ""
}
func (m *EventZrcWithdrawCreated) GetReceiver() string {
if m != nil {
return m.Receiver
}
return ""
}
func (m *EventZrcWithdrawCreated) GetReceiverChain() string {
if m != nil {
return m.ReceiverChain
}
return ""
}
func (m *EventZrcWithdrawCreated) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
func (m *EventZrcWithdrawCreated) GetNewStatus() string {
if m != nil {
return m.NewStatus
}
return ""
}
type EventZetaWithdrawCreated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"`
InTxHash string `protobuf:"bytes,4,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"`
NewStatus string `protobuf:"bytes,5,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
}
func (m *EventZetaWithdrawCreated) Reset() { *m = EventZetaWithdrawCreated{} }
func (m *EventZetaWithdrawCreated) String() string { return proto.CompactTextString(m) }
func (*EventZetaWithdrawCreated) ProtoMessage() {}
func (*EventZetaWithdrawCreated) Descriptor() ([]byte, []int) {
return fileDescriptor_7398db8b12b87b9e, []int{2}
}
func (m *EventZetaWithdrawCreated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventZetaWithdrawCreated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventZetaWithdrawCreated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventZetaWithdrawCreated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventZetaWithdrawCreated.Merge(m, src)
}
func (m *EventZetaWithdrawCreated) XXX_Size() int {
return m.Size()
}
func (m *EventZetaWithdrawCreated) XXX_DiscardUnknown() {
xxx_messageInfo_EventZetaWithdrawCreated.DiscardUnknown(m)
}
var xxx_messageInfo_EventZetaWithdrawCreated proto.InternalMessageInfo
func (m *EventZetaWithdrawCreated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventZetaWithdrawCreated) GetCctxIndex() string {
if m != nil {
return m.CctxIndex
}
return ""
}
func (m *EventZetaWithdrawCreated) GetSender() string {
if m != nil {
return m.Sender
}
return ""
}
func (m *EventZetaWithdrawCreated) GetInTxHash() string {
if m != nil {
return m.InTxHash
}
return ""
}
func (m *EventZetaWithdrawCreated) GetNewStatus() string {
if m != nil {
return m.NewStatus
}
return ""
}
type EventOutboundFailure struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"`
NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
ValueReceived string `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3" json:"value_received,omitempty"`
}
func (m *EventOutboundFailure) Reset() { *m = EventOutboundFailure{} }
func (m *EventOutboundFailure) String() string { return proto.CompactTextString(m) }
func (*EventOutboundFailure) ProtoMessage() {}
func (*EventOutboundFailure) Descriptor() ([]byte, []int) {
return fileDescriptor_7398db8b12b87b9e, []int{3}
}
func (m *EventOutboundFailure) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventOutboundFailure) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventOutboundFailure.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventOutboundFailure) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventOutboundFailure.Merge(m, src)
}
func (m *EventOutboundFailure) XXX_Size() int {
return m.Size()
}
func (m *EventOutboundFailure) XXX_DiscardUnknown() {
xxx_messageInfo_EventOutboundFailure.DiscardUnknown(m)
}
var xxx_messageInfo_EventOutboundFailure proto.InternalMessageInfo
func (m *EventOutboundFailure) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventOutboundFailure) GetCctxIndex() string {
if m != nil {
return m.CctxIndex
}
return ""
}
func (m *EventOutboundFailure) GetOldStatus() string {
if m != nil {
return m.OldStatus
}
return ""
}
func (m *EventOutboundFailure) GetNewStatus() string {
if m != nil {
return m.NewStatus
}
return ""
}
func (m *EventOutboundFailure) GetValueReceived() string {
if m != nil {
return m.ValueReceived
}
return ""
}
type EventOutboundSuccess struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"`
NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
ValueReceived string `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3" json:"value_received,omitempty"`
}
func (m *EventOutboundSuccess) Reset() { *m = EventOutboundSuccess{} }
func (m *EventOutboundSuccess) String() string { return proto.CompactTextString(m) }
func (*EventOutboundSuccess) ProtoMessage() {}
func (*EventOutboundSuccess) Descriptor() ([]byte, []int) {
return fileDescriptor_7398db8b12b87b9e, []int{4}
}
func (m *EventOutboundSuccess) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventOutboundSuccess) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventOutboundSuccess.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventOutboundSuccess) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventOutboundSuccess.Merge(m, src)
}
func (m *EventOutboundSuccess) XXX_Size() int {
return m.Size()
}
func (m *EventOutboundSuccess) XXX_DiscardUnknown() {
xxx_messageInfo_EventOutboundSuccess.DiscardUnknown(m)
}
var xxx_messageInfo_EventOutboundSuccess proto.InternalMessageInfo
func (m *EventOutboundSuccess) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventOutboundSuccess) GetCctxIndex() string {
if m != nil {
return m.CctxIndex
}
return ""
}
func (m *EventOutboundSuccess) GetOldStatus() string {
if m != nil {
return m.OldStatus
}
return ""
}
func (m *EventOutboundSuccess) GetNewStatus() string {
if m != nil {
return m.NewStatus
}
return ""
}
func (m *EventOutboundSuccess) GetValueReceived() string {
if m != nil {
return m.ValueReceived
}
return ""
}
func init() {
proto.RegisterType((*EventInboundFinalized)(nil), "zetachain.zetacore.crosschain.EventInboundFinalized")
proto.RegisterType((*EventZrcWithdrawCreated)(nil), "zetachain.zetacore.crosschain.EventZrcWithdrawCreated")
proto.RegisterType((*EventZetaWithdrawCreated)(nil), "zetachain.zetacore.crosschain.EventZetaWithdrawCreated")
proto.RegisterType((*EventOutboundFailure)(nil), "zetachain.zetacore.crosschain.EventOutboundFailure")
proto.RegisterType((*EventOutboundSuccess)(nil), "zetachain.zetacore.crosschain.EventOutboundSuccess")
}
func init() { proto.RegisterFile("crosschain/events.proto", fileDescriptor_7398db8b12b87b9e) }
var fileDescriptor_7398db8b12b87b9e = []byte{
// 586 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xdd, 0x6a, 0xd4, 0x40,
0x14, 0x6e, 0xda, 0xdd, 0xed, 0xee, 0xf4, 0x0f, 0x62, 0xb5, 0x63, 0xb1, 0xa1, 0x2e, 0xf8, 0x73,
0xe3, 0x06, 0xf1, 0x0d, 0x5a, 0x94, 0x16, 0x91, 0x42, 0x5b, 0x11, 0x7a, 0x33, 0xcc, 0x26, 0x87,
0x64, 0x30, 0x99, 0x59, 0x66, 0x26, 0xbb, 0xd9, 0x3e, 0x85, 0x2f, 0x22, 0xf8, 0x00, 0x3e, 0x80,
0x97, 0xbd, 0xf0, 0xc2, 0x4b, 0xd9, 0x7d, 0x11, 0x99, 0x99, 0x44, 0xbb, 0xa9, 0xe8, 0x85, 0x28,
0x78, 0x95, 0x73, 0xbe, 0x73, 0x72, 0xf2, 0xcd, 0xf7, 0x4d, 0x0e, 0xda, 0x89, 0xa4, 0x50, 0x2a,
0x4a, 0x29, 0xe3, 0x21, 0x8c, 0x81, 0x6b, 0x35, 0x18, 0x49, 0xa1, 0x85, 0xbf, 0x77, 0x09, 0x9a,
0x5a, 0x7c, 0x60, 0x23, 0x21, 0x61, 0xf0, 0xa3, 0x77, 0xf7, 0x56, 0x24, 0xf2, 0x5c, 0xf0, 0xd0,
0x3d, 0xdc, 0x3b, 0xbb, 0xdb, 0x89, 0x48, 0x84, 0x0d, 0x43, 0x13, 0x39, 0xb4, 0xff, 0x79, 0x05,
0xdd, 0x7e, 0x6e, 0x46, 0x1f, 0xf3, 0xa1, 0x28, 0x78, 0xfc, 0x82, 0x71, 0x9a, 0xb1, 0x4b, 0x88,
0xfd, 0x7d, 0xb4, 0x9e, 0xab, 0x84, 0xe8, 0xe9, 0x08, 0x48, 0x21, 0x33, 0xec, 0xed, 0x7b, 0x8f,
0x7b, 0xa7, 0x28, 0x57, 0xc9, 0xf9, 0x74, 0x04, 0xaf, 0x65, 0xe6, 0xef, 0x21, 0x14, 0x45, 0xba,
0x24, 0x8c, 0xc7, 0x50, 0xe2, 0x65, 0x5b, 0xef, 0x19, 0xe4, 0xd8, 0x00, 0xfe, 0x1d, 0xd4, 0x51,
0xc0, 0x63, 0x90, 0x78, 0xc5, 0x96, 0xaa, 0xcc, 0xbf, 0x8b, 0xba, 0xba, 0x24, 0x42, 0x26, 0x8c,
0xe3, 0x96, 0xad, 0xac, 0xea, 0xf2, 0xc4, 0xa4, 0xfe, 0x36, 0x6a, 0x53, 0xa5, 0x40, 0xe3, 0xb6,
0xc5, 0x5d, 0xe2, 0xdf, 0x43, 0x88, 0x71, 0xa2, 0x4b, 0x92, 0x52, 0x95, 0xe2, 0x8e, 0x2d, 0x75,
0x19, 0x3f, 0x2f, 0x8f, 0xa8, 0x4a, 0xfd, 0x87, 0x68, 0x8b, 0x71, 0x32, 0xcc, 0x44, 0xf4, 0x96,
0xa4, 0xc0, 0x92, 0x54, 0xe3, 0x55, 0xdb, 0xb2, 0xc1, 0xf8, 0x81, 0x41, 0x8f, 0x2c, 0xe8, 0xef,
0xa2, 0xae, 0x84, 0x08, 0xd8, 0x18, 0x24, 0xee, 0xba, 0x19, 0x75, 0xee, 0x3f, 0x40, 0x9b, 0x75,
0x4c, 0xac, 0x84, 0xb8, 0xe7, 0x46, 0xd4, 0xe8, 0xa1, 0x01, 0xcd, 0x89, 0x68, 0x2e, 0x0a, 0xae,
0x31, 0x72, 0x27, 0x72, 0x99, 0xff, 0x08, 0x6d, 0x49, 0xc8, 0xe8, 0x14, 0x62, 0x92, 0x83, 0x52,
0x34, 0x01, 0xbc, 0x66, 0x1b, 0x36, 0x2b, 0xf8, 0x95, 0x43, 0x8d, 0x62, 0x1c, 0x26, 0x44, 0x69,
0xaa, 0x0b, 0x85, 0xd7, 0x9d, 0x62, 0x1c, 0x26, 0x67, 0x16, 0x30, 0x34, 0x5c, 0xe9, 0xfb, 0x98,
0x0d, 0x47, 0xc3, 0xa1, 0xf5, 0x94, 0xfb, 0x68, 0xdd, 0x49, 0x59, 0x71, 0xdd, 0xb4, 0x4d, 0x6b,
0x0e, 0xb3, 0x4c, 0xfb, 0xef, 0x97, 0xd1, 0x8e, 0xb5, 0xf5, 0x42, 0x46, 0x6f, 0x98, 0x4e, 0x63,
0x49, 0x27, 0x87, 0x12, 0xa8, 0xfe, 0x9b, 0xc6, 0x36, 0x79, 0xb5, 0x6e, 0xf0, 0x6a, 0x58, 0xd9,
0x6e, 0x58, 0x79, 0xdd, 0xa2, 0xce, 0x6f, 0x2d, 0x5a, 0xfd, 0xb5, 0x45, 0xdd, 0x05, 0x8b, 0x16,
0x95, 0xef, 0x35, 0x94, 0xef, 0x7f, 0xf0, 0x10, 0x76, 0x7a, 0x81, 0xa6, 0xff, 0x4c, 0xb0, 0x45,
0x35, 0x5a, 0x0d, 0x35, 0x16, 0x29, 0xb7, 0x9b, 0x94, 0x3f, 0x7a, 0x68, 0xdb, 0x52, 0x3e, 0x29,
0xb4, 0xfb, 0x75, 0x29, 0xcb, 0x0a, 0x09, 0x7f, 0x4e, 0x77, 0x0f, 0x21, 0x91, 0xc5, 0xf5, 0x87,
0x1d, 0xe5, 0x9e, 0xc8, 0xe2, 0xea, 0x96, 0x2e, 0xf2, 0x6a, 0xfd, 0xe4, 0x12, 0x8f, 0x69, 0x56,
0x00, 0xa9, 0x8c, 0x89, 0x2b, 0xea, 0x1b, 0x16, 0x3d, 0xad, 0xc0, 0x9b, 0xf4, 0xcf, 0x8a, 0x28,
0x02, 0xa5, 0xfe, 0x0f, 0xfa, 0x07, 0x2f, 0x3f, 0xcd, 0x02, 0xef, 0x6a, 0x16, 0x78, 0x5f, 0x67,
0x81, 0xf7, 0x6e, 0x1e, 0x2c, 0x5d, 0xcd, 0x83, 0xa5, 0x2f, 0xf3, 0x60, 0xe9, 0xe2, 0x69, 0xc2,
0x74, 0x5a, 0x0c, 0x07, 0x91, 0xc8, 0x43, 0xb3, 0x9c, 0x9f, 0xb8, 0xfd, 0x5d, 0xef, 0xe9, 0xb0,
0x0c, 0xaf, 0x6d, 0x75, 0x73, 0x4a, 0x35, 0xec, 0xd8, 0x5d, 0xfc, 0xec, 0x5b, 0x00, 0x00, 0x00,
0xff, 0xff, 0xee, 0x0c, 0x96, 0x59, 0xf0, 0x05, 0x00, 0x00,
}
func (m *EventInboundFinalized) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventInboundFinalized) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventInboundFinalized) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.SenderChain) > 0 {
i -= len(m.SenderChain)
copy(dAtA[i:], m.SenderChain)
i = encodeVarintEvents(dAtA, i, uint64(len(m.SenderChain)))
i--
dAtA[i] = 0x72
}
if len(m.StatusMessage) > 0 {
i -= len(m.StatusMessage)
copy(dAtA[i:], m.StatusMessage)
i = encodeVarintEvents(dAtA, i, uint64(len(m.StatusMessage)))
i--
dAtA[i] = 0x6a
}
if len(m.NewStatus) > 0 {
i -= len(m.NewStatus)
copy(dAtA[i:], m.NewStatus)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewStatus)))
i--
dAtA[i] = 0x62
}
if len(m.RelayedMessage) > 0 {
i -= len(m.RelayedMessage)
copy(dAtA[i:], m.RelayedMessage)
i = encodeVarintEvents(dAtA, i, uint64(len(m.RelayedMessage)))
i--
dAtA[i] = 0x5a
}
if len(m.Amount) > 0 {
i -= len(m.Amount)
copy(dAtA[i:], m.Amount)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Amount)))
i--
dAtA[i] = 0x52
}
if len(m.ReceiverChain) > 0 {
i -= len(m.ReceiverChain)
copy(dAtA[i:], m.ReceiverChain)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ReceiverChain)))
i--
dAtA[i] = 0x4a
}
if len(m.Receiver) > 0 {
i -= len(m.Receiver)
copy(dAtA[i:], m.Receiver)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Receiver)))
i--
dAtA[i] = 0x42
}
if len(m.InBlockHeight) > 0 {
i -= len(m.InBlockHeight)
copy(dAtA[i:], m.InBlockHeight)
i = encodeVarintEvents(dAtA, i, uint64(len(m.InBlockHeight)))
i--
dAtA[i] = 0x3a
}
if len(m.InTxHash) > 0 {
i -= len(m.InTxHash)
copy(dAtA[i:], m.InTxHash)
i = encodeVarintEvents(dAtA, i, uint64(len(m.InTxHash)))
i--
dAtA[i] = 0x32
}
if len(m.Asset) > 0 {
i -= len(m.Asset)
copy(dAtA[i:], m.Asset)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Asset)))
i--
dAtA[i] = 0x2a
}
if len(m.TxOrgin) > 0 {
i -= len(m.TxOrgin)
copy(dAtA[i:], m.TxOrgin)
i = encodeVarintEvents(dAtA, i, uint64(len(m.TxOrgin)))
i--
dAtA[i] = 0x22
}
if len(m.Sender) > 0 {
i -= len(m.Sender)
copy(dAtA[i:], m.Sender)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Sender)))
i--
dAtA[i] = 0x1a
}
if len(m.CctxIndex) > 0 {
i -= len(m.CctxIndex)
copy(dAtA[i:], m.CctxIndex)
i = encodeVarintEvents(dAtA, i, uint64(len(m.CctxIndex)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventZrcWithdrawCreated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventZrcWithdrawCreated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventZrcWithdrawCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NewStatus) > 0 {
i -= len(m.NewStatus)
copy(dAtA[i:], m.NewStatus)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewStatus)))
i--
dAtA[i] = 0x4a
}
if len(m.Amount) > 0 {
i -= len(m.Amount)
copy(dAtA[i:], m.Amount)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Amount)))
i--
dAtA[i] = 0x42
}
if len(m.ReceiverChain) > 0 {
i -= len(m.ReceiverChain)
copy(dAtA[i:], m.ReceiverChain)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ReceiverChain)))
i--
dAtA[i] = 0x3a
}
if len(m.Receiver) > 0 {
i -= len(m.Receiver)
copy(dAtA[i:], m.Receiver)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Receiver)))
i--
dAtA[i] = 0x32
}
if len(m.InTxHash) > 0 {
i -= len(m.InTxHash)
copy(dAtA[i:], m.InTxHash)
i = encodeVarintEvents(dAtA, i, uint64(len(m.InTxHash)))
i--
dAtA[i] = 0x2a
}
if len(m.SenderChain) > 0 {
i -= len(m.SenderChain)
copy(dAtA[i:], m.SenderChain)
i = encodeVarintEvents(dAtA, i, uint64(len(m.SenderChain)))
i--
dAtA[i] = 0x22
}
if len(m.Sender) > 0 {
i -= len(m.Sender)
copy(dAtA[i:], m.Sender)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Sender)))
i--
dAtA[i] = 0x1a
}
if len(m.CctxIndex) > 0 {
i -= len(m.CctxIndex)
copy(dAtA[i:], m.CctxIndex)
i = encodeVarintEvents(dAtA, i, uint64(len(m.CctxIndex)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventZetaWithdrawCreated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventZetaWithdrawCreated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventZetaWithdrawCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NewStatus) > 0 {
i -= len(m.NewStatus)
copy(dAtA[i:], m.NewStatus)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewStatus)))
i--
dAtA[i] = 0x2a
}
if len(m.InTxHash) > 0 {
i -= len(m.InTxHash)
copy(dAtA[i:], m.InTxHash)
i = encodeVarintEvents(dAtA, i, uint64(len(m.InTxHash)))
i--
dAtA[i] = 0x22
}
if len(m.Sender) > 0 {
i -= len(m.Sender)
copy(dAtA[i:], m.Sender)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Sender)))
i--
dAtA[i] = 0x1a
}
if len(m.CctxIndex) > 0 {
i -= len(m.CctxIndex)
copy(dAtA[i:], m.CctxIndex)
i = encodeVarintEvents(dAtA, i, uint64(len(m.CctxIndex)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventOutboundFailure) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventOutboundFailure) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventOutboundFailure) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValueReceived) > 0 {
i -= len(m.ValueReceived)
copy(dAtA[i:], m.ValueReceived)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ValueReceived)))
i--
dAtA[i] = 0x2a
}
if len(m.NewStatus) > 0 {
i -= len(m.NewStatus)
copy(dAtA[i:], m.NewStatus)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewStatus)))
i--
dAtA[i] = 0x22
}
if len(m.OldStatus) > 0 {
i -= len(m.OldStatus)
copy(dAtA[i:], m.OldStatus)
i = encodeVarintEvents(dAtA, i, uint64(len(m.OldStatus)))
i--
dAtA[i] = 0x1a
}
if len(m.CctxIndex) > 0 {
i -= len(m.CctxIndex)
copy(dAtA[i:], m.CctxIndex)
i = encodeVarintEvents(dAtA, i, uint64(len(m.CctxIndex)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventOutboundSuccess) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventOutboundSuccess) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventOutboundSuccess) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValueReceived) > 0 {
i -= len(m.ValueReceived)
copy(dAtA[i:], m.ValueReceived)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ValueReceived)))
i--
dAtA[i] = 0x2a
}
if len(m.NewStatus) > 0 {
i -= len(m.NewStatus)
copy(dAtA[i:], m.NewStatus)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewStatus)))
i--
dAtA[i] = 0x22
}
if len(m.OldStatus) > 0 {
i -= len(m.OldStatus)
copy(dAtA[i:], m.OldStatus)
i = encodeVarintEvents(dAtA, i, uint64(len(m.OldStatus)))
i--
dAtA[i] = 0x1a
}
if len(m.CctxIndex) > 0 {
i -= len(m.CctxIndex)
copy(dAtA[i:], m.CctxIndex)
i = encodeVarintEvents(dAtA, i, uint64(len(m.CctxIndex)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
offset -= sovEvents(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *EventInboundFinalized) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.CctxIndex)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Sender)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.TxOrgin)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Asset)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.InTxHash)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.InBlockHeight)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Receiver)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ReceiverChain)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Amount)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.RelayedMessage)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewStatus)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.StatusMessage)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.SenderChain)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventZrcWithdrawCreated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.CctxIndex)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Sender)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.SenderChain)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.InTxHash)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Receiver)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ReceiverChain)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Amount)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewStatus)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventZetaWithdrawCreated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.CctxIndex)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Sender)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.InTxHash)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewStatus)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventOutboundFailure) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.CctxIndex)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.OldStatus)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewStatus)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ValueReceived)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventOutboundSuccess) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.CctxIndex)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.OldStatus)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewStatus)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ValueReceived)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func sovEvents(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozEvents(x uint64) (n int) {
return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *EventInboundFinalized) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventInboundFinalized: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventInboundFinalized: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Sender = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxOrgin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxOrgin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Asset = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InBlockHeight", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InBlockHeight = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Receiver = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ReceiverChain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ReceiverChain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Amount = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RelayedMessage", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.RelayedMessage = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewStatus", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewStatus = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field StatusMessage", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.StatusMessage = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 14:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SenderChain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SenderChain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventZrcWithdrawCreated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventZrcWithdrawCreated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventZrcWithdrawCreated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Sender = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SenderChain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SenderChain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Receiver = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ReceiverChain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ReceiverChain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Amount = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewStatus", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewStatus = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventZetaWithdrawCreated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventZetaWithdrawCreated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventZetaWithdrawCreated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Sender = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewStatus", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewStatus = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventOutboundFailure) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventOutboundFailure: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventOutboundFailure: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OldStatus", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OldStatus = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewStatus", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewStatus = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValueReceived = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventOutboundSuccess) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventOutboundSuccess: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventOutboundSuccess: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OldStatus", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OldStatus = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewStatus", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewStatus = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValueReceived = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEvents(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthEvents
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEvents
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/gas_price.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type GasPrice struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Index string `protobuf:"bytes,2,opt,name=index,proto3" json:"index,omitempty"`
ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Signers []string `protobuf:"bytes,4,rep,name=signers,proto3" json:"signers,omitempty"`
BlockNums []uint64 `protobuf:"varint,5,rep,packed,name=block_nums,json=blockNums,proto3" json:"block_nums,omitempty"`
Prices []uint64 `protobuf:"varint,6,rep,packed,name=prices,proto3" json:"prices,omitempty"`
MedianIndex uint64 `protobuf:"varint,7,opt,name=median_index,json=medianIndex,proto3" json:"median_index,omitempty"`
}
func (m *GasPrice) Reset() { *m = GasPrice{} }
func (m *GasPrice) String() string { return proto.CompactTextString(m) }
func (*GasPrice) ProtoMessage() {}
func (*GasPrice) Descriptor() ([]byte, []int) {
return fileDescriptor_a9c78c67aa323583, []int{0}
}
func (m *GasPrice) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GasPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GasPrice.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GasPrice) XXX_Merge(src proto.Message) {
xxx_messageInfo_GasPrice.Merge(m, src)
}
func (m *GasPrice) XXX_Size() int {
return m.Size()
}
func (m *GasPrice) XXX_DiscardUnknown() {
xxx_messageInfo_GasPrice.DiscardUnknown(m)
}
var xxx_messageInfo_GasPrice proto.InternalMessageInfo
func (m *GasPrice) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *GasPrice) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *GasPrice) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *GasPrice) GetSigners() []string {
if m != nil {
return m.Signers
}
return nil
}
func (m *GasPrice) GetBlockNums() []uint64 {
if m != nil {
return m.BlockNums
}
return nil
}
func (m *GasPrice) GetPrices() []uint64 {
if m != nil {
return m.Prices
}
return nil
}
func (m *GasPrice) GetMedianIndex() uint64 {
if m != nil {
return m.MedianIndex
}
return 0
}
func init() {
proto.RegisterType((*GasPrice)(nil), "zetachain.zetacore.crosschain.GasPrice")
}
func init() { proto.RegisterFile("crosschain/gas_price.proto", fileDescriptor_a9c78c67aa323583) }
var fileDescriptor_a9c78c67aa323583 = []byte{
// 276 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x41, 0x4a, 0xc4, 0x30,
0x14, 0x86, 0x27, 0xb6, 0xd3, 0xce, 0x44, 0x57, 0x41, 0x24, 0x0a, 0x13, 0xaa, 0xab, 0x6e, 0x6c,
0x11, 0x6f, 0xe0, 0x46, 0x06, 0x41, 0xa4, 0x4b, 0x37, 0x25, 0x4d, 0x43, 0x27, 0x68, 0x9b, 0x92,
0xd7, 0xc2, 0xe8, 0x29, 0x3c, 0x96, 0xee, 0x66, 0xe9, 0x52, 0xda, 0x8b, 0x48, 0xd2, 0x19, 0x74,
0x97, 0xef, 0x7f, 0x79, 0x3f, 0x8f, 0x0f, 0x5f, 0x08, 0xa3, 0x01, 0xc4, 0x86, 0xab, 0x26, 0xad,
0x38, 0xe4, 0xad, 0x51, 0x42, 0x26, 0xad, 0xd1, 0x9d, 0x26, 0xab, 0x77, 0xd9, 0x71, 0x37, 0x4a,
0xdc, 0x4b, 0x1b, 0x99, 0xfc, 0x7d, 0xbf, 0xfa, 0x42, 0x78, 0x71, 0xcf, 0xe1, 0xc9, 0x6e, 0x10,
0x8a, 0x43, 0x61, 0x24, 0xef, 0xb4, 0xa1, 0x28, 0x42, 0xf1, 0x32, 0x3b, 0x20, 0x39, 0xc5, 0x73,
0xd5, 0x94, 0x72, 0x4b, 0x8f, 0x5c, 0x3e, 0x01, 0x39, 0xc7, 0x0b, 0xd7, 0x92, 0xab, 0x92, 0x7a,
0x11, 0x8a, 0xbd, 0x2c, 0x74, 0xbc, 0x2e, 0x6d, 0x15, 0xa8, 0xaa, 0x91, 0x06, 0xa8, 0x1f, 0x79,
0xb6, 0x6a, 0x8f, 0x64, 0x85, 0x71, 0xf1, 0xaa, 0xc5, 0x4b, 0xde, 0xf4, 0x35, 0xd0, 0x79, 0xe4,
0xc5, 0x7e, 0xb6, 0x74, 0xc9, 0x63, 0x5f, 0x03, 0x39, 0xc3, 0x81, 0x3b, 0x1f, 0x68, 0xe0, 0x46,
0x7b, 0x22, 0x97, 0xf8, 0xa4, 0x96, 0xa5, 0xe2, 0x4d, 0x3e, 0x1d, 0x12, 0x46, 0x28, 0xf6, 0xb3,
0xe3, 0x29, 0x5b, 0xdb, 0xe8, 0xee, 0xe1, 0x73, 0x60, 0x68, 0x37, 0x30, 0xf4, 0x33, 0x30, 0xf4,
0x31, 0xb2, 0xd9, 0x6e, 0x64, 0xb3, 0xef, 0x91, 0xcd, 0x9e, 0x6f, 0x2a, 0xd5, 0x6d, 0xfa, 0x22,
0x11, 0xba, 0x4e, 0xad, 0x85, 0xeb, 0xc9, 0xd5, 0x41, 0x48, 0xba, 0x4d, 0xff, 0x19, 0xec, 0xde,
0x5a, 0x09, 0x45, 0xe0, 0xf4, 0xdd, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x63, 0xdc, 0xbf, 0x3d,
0x5c, 0x01, 0x00, 0x00,
}
func (m *GasPrice) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GasPrice) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GasPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.MedianIndex != 0 {
i = encodeVarintGasPrice(dAtA, i, uint64(m.MedianIndex))
i--
dAtA[i] = 0x38
}
if len(m.Prices) > 0 {
dAtA2 := make([]byte, len(m.Prices)*10)
var j1 int
for _, num := range m.Prices {
for num >= 1<<7 {
dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j1++
}
dAtA2[j1] = uint8(num)
j1++
}
i -= j1
copy(dAtA[i:], dAtA2[:j1])
i = encodeVarintGasPrice(dAtA, i, uint64(j1))
i--
dAtA[i] = 0x32
}
if len(m.BlockNums) > 0 {
dAtA4 := make([]byte, len(m.BlockNums)*10)
var j3 int
for _, num := range m.BlockNums {
for num >= 1<<7 {
dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j3++
}
dAtA4[j3] = uint8(num)
j3++
}
i -= j3
copy(dAtA[i:], dAtA4[:j3])
i = encodeVarintGasPrice(dAtA, i, uint64(j3))
i--
dAtA[i] = 0x2a
}
if len(m.Signers) > 0 {
for iNdEx := len(m.Signers) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Signers[iNdEx])
copy(dAtA[i:], m.Signers[iNdEx])
i = encodeVarintGasPrice(dAtA, i, uint64(len(m.Signers[iNdEx])))
i--
dAtA[i] = 0x22
}
}
if m.ChainId != 0 {
i = encodeVarintGasPrice(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x18
}
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintGasPrice(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintGasPrice(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintGasPrice(dAtA []byte, offset int, v uint64) int {
offset -= sovGasPrice(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GasPrice) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovGasPrice(uint64(l))
}
l = len(m.Index)
if l > 0 {
n += 1 + l + sovGasPrice(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovGasPrice(uint64(m.ChainId))
}
if len(m.Signers) > 0 {
for _, s := range m.Signers {
l = len(s)
n += 1 + l + sovGasPrice(uint64(l))
}
}
if len(m.BlockNums) > 0 {
l = 0
for _, e := range m.BlockNums {
l += sovGasPrice(uint64(e))
}
n += 1 + sovGasPrice(uint64(l)) + l
}
if len(m.Prices) > 0 {
l = 0
for _, e := range m.Prices {
l += sovGasPrice(uint64(e))
}
n += 1 + sovGasPrice(uint64(l)) + l
}
if m.MedianIndex != 0 {
n += 1 + sovGasPrice(uint64(m.MedianIndex))
}
return n
}
func sovGasPrice(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGasPrice(x uint64) (n int) {
return sovGasPrice(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GasPrice) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GasPrice: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GasPrice: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGasPrice
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGasPrice
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGasPrice
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGasPrice
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGasPrice
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGasPrice
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signers = append(m.Signers, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 5:
if wireType == 0 {
var v uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.BlockNums = append(m.BlockNums, v)
} else if wireType == 2 {
var packedLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
packedLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if packedLen < 0 {
return ErrInvalidLengthGasPrice
}
postIndex := iNdEx + packedLen
if postIndex < 0 {
return ErrInvalidLengthGasPrice
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
var elementCount int
var count int
for _, integer := range dAtA[iNdEx:postIndex] {
if integer < 128 {
count++
}
}
elementCount = count
if elementCount != 0 && len(m.BlockNums) == 0 {
m.BlockNums = make([]uint64, 0, elementCount)
}
for iNdEx < postIndex {
var v uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.BlockNums = append(m.BlockNums, v)
}
} else {
return fmt.Errorf("proto: wrong wireType = %d for field BlockNums", wireType)
}
case 6:
if wireType == 0 {
var v uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Prices = append(m.Prices, v)
} else if wireType == 2 {
var packedLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
packedLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if packedLen < 0 {
return ErrInvalidLengthGasPrice
}
postIndex := iNdEx + packedLen
if postIndex < 0 {
return ErrInvalidLengthGasPrice
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
var elementCount int
var count int
for _, integer := range dAtA[iNdEx:postIndex] {
if integer < 128 {
count++
}
}
elementCount = count
if elementCount != 0 && len(m.Prices) == 0 {
m.Prices = make([]uint64, 0, elementCount)
}
for iNdEx < postIndex {
var v uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Prices = append(m.Prices, v)
}
} else {
return fmt.Errorf("proto: wrong wireType = %d for field Prices", wireType)
}
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field MedianIndex", wireType)
}
m.MedianIndex = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGasPrice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.MedianIndex |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipGasPrice(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGasPrice
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGasPrice(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGasPrice
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGasPrice
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGasPrice
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGasPrice
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGasPrice
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGasPrice
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGasPrice = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGasPrice = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGasPrice = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
"encoding/json"
"fmt"
"github.com/cosmos/cosmos-sdk/codec"
)
// DefaultIndex is the default crosschain global index
const DefaultIndex uint64 = 1
// DefaultGenesis returns the default crosschain genesis state
func DefaultGenesis() *GenesisState {
return &GenesisState{
OutTxTrackerList: []OutTxTracker{},
InTxHashToCctxList: []InTxHashToCctx{},
GasPriceList: []*GasPrice{},
ChainNoncesList: []*ChainNonces{},
//CCTX: []*Send{},
}
}
// Validate performs basic genesis state validation returning an error upon any
// failure.
func (gs GenesisState) Validate() error {
// Check for duplicated index in outTxTracker
outTxTrackerIndexMap := make(map[string]struct{})
for _, elem := range gs.OutTxTrackerList {
index := string(OutTxTrackerKey(elem.Index))
if _, ok := outTxTrackerIndexMap[index]; ok {
return fmt.Errorf("duplicated index for outTxTracker")
}
outTxTrackerIndexMap[index] = struct{}{}
}
// Check for duplicated index in inTxHashToCctx
inTxHashToCctxIndexMap := make(map[string]struct{})
for _, elem := range gs.InTxHashToCctxList {
index := string(InTxHashToCctxKey(elem.InTxHash))
if _, ok := inTxHashToCctxIndexMap[index]; ok {
return fmt.Errorf("duplicated index for inTxHashToCctx")
}
inTxHashToCctxIndexMap[index] = struct{}{}
}
// TODO add migrate for TSS
// Check for duplicated index in gasPrice
gasPriceIndexMap := make(map[string]bool)
for _, elem := range gs.GasPriceList {
if _, ok := gasPriceIndexMap[elem.Index]; ok {
return fmt.Errorf("duplicated index for gasPrice")
}
gasPriceIndexMap[elem.Index] = true
}
// Check for duplicated index in chainNonces
chainNoncesIndexMap := make(map[string]bool)
for _, elem := range gs.ChainNoncesList {
if _, ok := chainNoncesIndexMap[elem.Index]; ok {
return fmt.Errorf("duplicated index for chainNonces")
}
chainNoncesIndexMap[elem.Index] = true
}
// Check for duplicated index in send
//sendIndexMap := make(map[string]bool)
//for _, elem := range gs.SendList {
// if _, ok := sendIndexMap[elem.Index]; ok {
// return fmt.Errorf("duplicated index for send")
// }
// sendIndexMap[elem.Index] = true
//}
return nil
}
func GetGenesisStateFromAppState(marshaler codec.JSONCodec, appState map[string]json.RawMessage) GenesisState {
var genesisState GenesisState
if appState[ModuleName] != nil {
err := marshaler.UnmarshalJSON(appState[ModuleName], &genesisState)
if err != nil {
panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error()))
}
}
return genesisState
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/genesis.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the metacore module's genesis state.
type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
OutTxTrackerList []OutTxTracker `protobuf:"bytes,2,rep,name=outTxTrackerList,proto3" json:"outTxTrackerList"`
Tss *TSS `protobuf:"bytes,4,opt,name=tss,proto3" json:"tss,omitempty"`
GasPriceList []*GasPrice `protobuf:"bytes,5,rep,name=gasPriceList,proto3" json:"gasPriceList,omitempty"`
ChainNoncesList []*ChainNonces `protobuf:"bytes,6,rep,name=chainNoncesList,proto3" json:"chainNoncesList,omitempty"`
CrossChainTxs []*CrossChainTx `protobuf:"bytes,7,rep,name=CrossChainTxs,proto3" json:"CrossChainTxs,omitempty"`
LastBlockHeightList []*LastBlockHeight `protobuf:"bytes,8,rep,name=lastBlockHeightList,proto3" json:"lastBlockHeightList,omitempty"`
InTxHashToCctxList []InTxHashToCctx `protobuf:"bytes,9,rep,name=inTxHashToCctxList,proto3" json:"inTxHashToCctxList"`
TssHistory []TSS `protobuf:"bytes,10,rep,name=tss_history,json=tssHistory,proto3" json:"tss_history"`
InTxTrackerList []InTxTracker `protobuf:"bytes,11,rep,name=in_tx_tracker_list,json=inTxTrackerList,proto3" json:"in_tx_tracker_list"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_dd51403692d571f4, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
func (m *GenesisState) GetOutTxTrackerList() []OutTxTracker {
if m != nil {
return m.OutTxTrackerList
}
return nil
}
func (m *GenesisState) GetTss() *TSS {
if m != nil {
return m.Tss
}
return nil
}
func (m *GenesisState) GetGasPriceList() []*GasPrice {
if m != nil {
return m.GasPriceList
}
return nil
}
func (m *GenesisState) GetChainNoncesList() []*ChainNonces {
if m != nil {
return m.ChainNoncesList
}
return nil
}
func (m *GenesisState) GetCrossChainTxs() []*CrossChainTx {
if m != nil {
return m.CrossChainTxs
}
return nil
}
func (m *GenesisState) GetLastBlockHeightList() []*LastBlockHeight {
if m != nil {
return m.LastBlockHeightList
}
return nil
}
func (m *GenesisState) GetInTxHashToCctxList() []InTxHashToCctx {
if m != nil {
return m.InTxHashToCctxList
}
return nil
}
func (m *GenesisState) GetTssHistory() []TSS {
if m != nil {
return m.TssHistory
}
return nil
}
func (m *GenesisState) GetInTxTrackerList() []InTxTracker {
if m != nil {
return m.InTxTrackerList
}
return nil
}
func init() {
proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.crosschain.GenesisState")
}
func init() { proto.RegisterFile("crosschain/genesis.proto", fileDescriptor_dd51403692d571f4) }
var fileDescriptor_dd51403692d571f4 = []byte{
// 512 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xd1, 0x6e, 0xd3, 0x30,
0x14, 0x86, 0x1b, 0x36, 0x0a, 0xb8, 0x43, 0x43, 0x06, 0x89, 0xa8, 0xd2, 0xb2, 0xa9, 0x08, 0x31,
0x81, 0x96, 0x88, 0xc1, 0x13, 0xb4, 0x17, 0xeb, 0xb4, 0x09, 0x46, 0x9a, 0x2b, 0xa4, 0xc9, 0xb8,
0x96, 0x95, 0x44, 0xeb, 0xe2, 0x2a, 0xc7, 0x95, 0x32, 0x9e, 0x82, 0xc7, 0xda, 0x1d, 0xbb, 0xe4,
0x0a, 0xa1, 0xf6, 0x45, 0x90, 0x4f, 0xb2, 0xcd, 0xa1, 0x15, 0xe9, 0x4d, 0x65, 0xe5, 0xfc, 0xff,
0x77, 0xfe, 0xda, 0xe7, 0x10, 0x57, 0xe4, 0x0a, 0x40, 0x24, 0x3c, 0xcd, 0x82, 0x58, 0x66, 0x12,
0x52, 0xf0, 0xa7, 0xb9, 0xd2, 0x8a, 0xee, 0x7c, 0x97, 0x9a, 0x63, 0xc1, 0xc7, 0x93, 0xca, 0xa5,
0x7f, 0x2f, 0xee, 0xee, 0x58, 0x46, 0xfc, 0x65, 0x99, 0xca, 0x84, 0xac, 0xdc, 0xdd, 0x5d, 0xbb,
0x6c, 0x8e, 0xac, 0x14, 0xe9, 0xa2, 0x12, 0x74, 0xed, 0xc6, 0x1c, 0xd8, 0x34, 0x4f, 0x85, 0xac,
0x6a, 0xaf, 0xac, 0x1a, 0x7a, 0x58, 0xc2, 0x21, 0x61, 0x5a, 0x31, 0x21, 0xee, 0x00, 0xde, 0x92,
0x48, 0xe7, 0x5c, 0x5c, 0xc8, 0xbc, 0xaa, 0xf7, 0xac, 0xfa, 0x84, 0x83, 0x66, 0xe3, 0x89, 0x12,
0x17, 0x2c, 0x91, 0x69, 0x9c, 0xe8, 0x15, 0x29, 0xd5, 0x4c, 0x2f, 0x43, 0x5e, 0x5a, 0x82, 0x29,
0xcf, 0xf9, 0xe5, 0xed, 0xff, 0x7b, 0x61, 0x15, 0x34, 0xdc, 0x7d, 0x8d, 0x55, 0xac, 0xf0, 0x18,
0x98, 0x53, 0xf9, 0xb5, 0xf7, 0xb3, 0x4d, 0xb6, 0x8e, 0xca, 0xbb, 0x1d, 0x69, 0xae, 0x25, 0x1d,
0x90, 0x76, 0x09, 0x73, 0x9d, 0x3d, 0x67, 0xbf, 0x73, 0xf8, 0xda, 0xff, 0xef, 0x5d, 0xfb, 0x67,
0x28, 0xee, 0x6f, 0x5e, 0xff, 0xde, 0x6d, 0x85, 0x95, 0x95, 0x9e, 0x93, 0x67, 0x6a, 0xa6, 0xa3,
0x22, 0x2a, 0x03, 0x9f, 0xa6, 0xa0, 0xdd, 0x07, 0x7b, 0x1b, 0xfb, 0x9d, 0xc3, 0x77, 0x0d, 0xb8,
0xcf, 0x96, 0xad, 0x82, 0x2e, 0xa1, 0xe8, 0x47, 0xb2, 0xa1, 0x01, 0xdc, 0x4d, 0x0c, 0xd8, 0x6b,
0x20, 0x46, 0xa3, 0x51, 0x68, 0xe4, 0xf4, 0x84, 0x6c, 0xc5, 0x1c, 0xce, 0xcc, 0x5b, 0x62, 0xa0,
0x87, 0x18, 0xe8, 0x4d, 0x83, 0xfd, 0xa8, 0xb2, 0x84, 0x35, 0x33, 0x8d, 0xc8, 0x36, 0xd6, 0x3f,
0xe1, 0x60, 0x21, 0xaf, 0x8d, 0xbc, 0xb7, 0x0d, 0xbc, 0xc1, 0xbd, 0x2b, 0xfc, 0x17, 0x41, 0xbf,
0x90, 0xa7, 0x03, 0x23, 0x45, 0x51, 0x54, 0x80, 0xfb, 0x68, 0xad, 0x4b, 0xb3, 0x3d, 0x61, 0x9d,
0x40, 0xbf, 0x91, 0xe7, 0x66, 0xc2, 0xfa, 0x66, 0xc0, 0x86, 0x38, 0x5f, 0x18, 0xf6, 0x31, 0x82,
0xfd, 0x06, 0xf0, 0x69, 0xdd, 0x19, 0xae, 0x42, 0x51, 0x41, 0xa8, 0x69, 0x35, 0xe4, 0x90, 0x44,
0x6a, 0x20, 0x74, 0x81, 0x0d, 0x9e, 0x60, 0x83, 0x83, 0x86, 0x06, 0xc7, 0x35, 0x63, 0xf5, 0xe0,
0x2b, 0x70, 0xf4, 0x98, 0x74, 0x34, 0x00, 0x4b, 0x52, 0xd0, 0x2a, 0xbf, 0x72, 0x09, 0xd2, 0xd7,
0x78, 0xfa, 0x0a, 0x49, 0x34, 0xc0, 0xb0, 0xf4, 0xd2, 0x73, 0x93, 0xd7, 0x5a, 0x27, 0x36, 0x31,
0x79, 0x3b, 0x6b, 0xbd, 0x9e, 0xc9, 0x5b, 0x9f, 0xce, 0xed, 0x34, 0xab, 0x0d, 0x67, 0xff, 0xe4,
0x7a, 0xee, 0x39, 0x37, 0x73, 0xcf, 0xf9, 0x33, 0xf7, 0x9c, 0x1f, 0x0b, 0xaf, 0x75, 0xb3, 0xf0,
0x5a, 0xbf, 0x16, 0x5e, 0xeb, 0xeb, 0xfb, 0x38, 0xd5, 0xc9, 0x6c, 0xec, 0x0b, 0x75, 0x19, 0x18,
0xf8, 0x41, 0xb9, 0xa2, 0xb7, 0x7d, 0x82, 0x22, 0xb0, 0x17, 0xf7, 0x6a, 0x2a, 0x61, 0xdc, 0xc6,
0x2d, 0xfd, 0xf0, 0x37, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x12, 0x5d, 0x65, 0x0b, 0x05, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.InTxTrackerList) > 0 {
for iNdEx := len(m.InTxTrackerList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.InTxTrackerList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x5a
}
}
if len(m.TssHistory) > 0 {
for iNdEx := len(m.TssHistory) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.TssHistory[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x52
}
}
if len(m.InTxHashToCctxList) > 0 {
for iNdEx := len(m.InTxHashToCctxList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.InTxHashToCctxList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x4a
}
}
if len(m.LastBlockHeightList) > 0 {
for iNdEx := len(m.LastBlockHeightList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.LastBlockHeightList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
}
}
if len(m.CrossChainTxs) > 0 {
for iNdEx := len(m.CrossChainTxs) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.CrossChainTxs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
}
}
if len(m.ChainNoncesList) > 0 {
for iNdEx := len(m.ChainNoncesList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.ChainNoncesList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
}
if len(m.GasPriceList) > 0 {
for iNdEx := len(m.GasPriceList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.GasPriceList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
}
if m.Tss != nil {
{
size, err := m.Tss.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
if len(m.OutTxTrackerList) > 0 {
for iNdEx := len(m.OutTxTrackerList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.OutTxTrackerList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
if len(m.OutTxTrackerList) > 0 {
for _, e := range m.OutTxTrackerList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if m.Tss != nil {
l = m.Tss.Size()
n += 1 + l + sovGenesis(uint64(l))
}
if len(m.GasPriceList) > 0 {
for _, e := range m.GasPriceList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.ChainNoncesList) > 0 {
for _, e := range m.ChainNoncesList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.CrossChainTxs) > 0 {
for _, e := range m.CrossChainTxs {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.LastBlockHeightList) > 0 {
for _, e := range m.LastBlockHeightList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.InTxHashToCctxList) > 0 {
for _, e := range m.InTxHashToCctxList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.TssHistory) > 0 {
for _, e := range m.TssHistory {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.InTxTrackerList) > 0 {
for _, e := range m.InTxTrackerList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutTxTrackerList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutTxTrackerList = append(m.OutTxTrackerList, OutTxTracker{})
if err := m.OutTxTrackerList[len(m.OutTxTrackerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Tss", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Tss == nil {
m.Tss = &TSS{}
}
if err := m.Tss.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GasPriceList = append(m.GasPriceList, &GasPrice{})
if err := m.GasPriceList[len(m.GasPriceList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainNoncesList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainNoncesList = append(m.ChainNoncesList, &ChainNonces{})
if err := m.ChainNoncesList[len(m.ChainNoncesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTxs", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CrossChainTxs = append(m.CrossChainTxs, &CrossChainTx{})
if err := m.CrossChainTxs[len(m.CrossChainTxs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeightList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LastBlockHeightList = append(m.LastBlockHeightList, &LastBlockHeight{})
if err := m.LastBlockHeightList[len(m.LastBlockHeightList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctxList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHashToCctxList = append(m.InTxHashToCctxList, InTxHashToCctx{})
if err := m.InTxHashToCctxList[len(m.InTxHashToCctxList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssHistory", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssHistory = append(m.TssHistory, TSS{})
if err := m.TssHistory[len(m.TssHistory)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxTrackerList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxTrackerList = append(m.InTxTrackerList, InTxTracker{})
if err := m.InTxTrackerList[len(m.InTxTrackerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/in_tx_hash_to_cctx.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type InTxHashToCctx struct {
InTxHash string `protobuf:"bytes,1,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"`
CctxIndex []string `protobuf:"bytes,2,rep,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
}
func (m *InTxHashToCctx) Reset() { *m = InTxHashToCctx{} }
func (m *InTxHashToCctx) String() string { return proto.CompactTextString(m) }
func (*InTxHashToCctx) ProtoMessage() {}
func (*InTxHashToCctx) Descriptor() ([]byte, []int) {
return fileDescriptor_67ee1b8208d56a23, []int{0}
}
func (m *InTxHashToCctx) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *InTxHashToCctx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_InTxHashToCctx.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *InTxHashToCctx) XXX_Merge(src proto.Message) {
xxx_messageInfo_InTxHashToCctx.Merge(m, src)
}
func (m *InTxHashToCctx) XXX_Size() int {
return m.Size()
}
func (m *InTxHashToCctx) XXX_DiscardUnknown() {
xxx_messageInfo_InTxHashToCctx.DiscardUnknown(m)
}
var xxx_messageInfo_InTxHashToCctx proto.InternalMessageInfo
func (m *InTxHashToCctx) GetInTxHash() string {
if m != nil {
return m.InTxHash
}
return ""
}
func (m *InTxHashToCctx) GetCctxIndex() []string {
if m != nil {
return m.CctxIndex
}
return nil
}
func init() {
proto.RegisterType((*InTxHashToCctx)(nil), "zetachain.zetacore.crosschain.InTxHashToCctx")
}
func init() {
proto.RegisterFile("crosschain/in_tx_hash_to_cctx.proto", fileDescriptor_67ee1b8208d56a23)
}
var fileDescriptor_67ee1b8208d56a23 = []byte{
// 202 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x2e, 0xca, 0x2f,
0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0xcc, 0x8b, 0x2f, 0xa9, 0x88, 0xcf, 0x48, 0x2c,
0xce, 0x88, 0x2f, 0xc9, 0x8f, 0x4f, 0x4e, 0x2e, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
0x92, 0xad, 0x4a, 0x2d, 0x49, 0x04, 0xab, 0xd1, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x10, 0xfa,
0x94, 0x7c, 0xb9, 0xf8, 0x3c, 0xf3, 0x42, 0x2a, 0x3c, 0x12, 0x8b, 0x33, 0x42, 0xf2, 0x9d, 0x93,
0x4b, 0x2a, 0x84, 0x64, 0xb8, 0xb8, 0x10, 0x86, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x71,
0x64, 0x42, 0xd5, 0x08, 0xc9, 0x72, 0x71, 0x81, 0x0c, 0x8f, 0xcf, 0xcc, 0x4b, 0x49, 0xad, 0x90,
0x60, 0x52, 0x60, 0xd6, 0xe0, 0x0c, 0xe2, 0x04, 0x89, 0x78, 0x82, 0x04, 0x9c, 0xbc, 0x4f, 0x3c,
0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e,
0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49,
0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xe4, 0x10, 0x5d, 0x88, 0xbb, 0x61, 0x6e, 0xd2, 0xaf, 0xd0, 0x47,
0xf2, 0x4d, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x07, 0xc6, 0x80, 0x00, 0x00, 0x00,
0xff, 0xff, 0xcd, 0xdf, 0x3b, 0x6d, 0xe8, 0x00, 0x00, 0x00,
}
func (m *InTxHashToCctx) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *InTxHashToCctx) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *InTxHashToCctx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.CctxIndex) > 0 {
for iNdEx := len(m.CctxIndex) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.CctxIndex[iNdEx])
copy(dAtA[i:], m.CctxIndex[iNdEx])
i = encodeVarintInTxHashToCctx(dAtA, i, uint64(len(m.CctxIndex[iNdEx])))
i--
dAtA[i] = 0x12
}
}
if len(m.InTxHash) > 0 {
i -= len(m.InTxHash)
copy(dAtA[i:], m.InTxHash)
i = encodeVarintInTxHashToCctx(dAtA, i, uint64(len(m.InTxHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintInTxHashToCctx(dAtA []byte, offset int, v uint64) int {
offset -= sovInTxHashToCctx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *InTxHashToCctx) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.InTxHash)
if l > 0 {
n += 1 + l + sovInTxHashToCctx(uint64(l))
}
if len(m.CctxIndex) > 0 {
for _, s := range m.CctxIndex {
l = len(s)
n += 1 + l + sovInTxHashToCctx(uint64(l))
}
}
return n
}
func sovInTxHashToCctx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozInTxHashToCctx(x uint64) (n int) {
return sovInTxHashToCctx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *InTxHashToCctx) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowInTxHashToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: InTxHashToCctx: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: InTxHashToCctx: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowInTxHashToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthInTxHashToCctx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthInTxHashToCctx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowInTxHashToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthInTxHashToCctx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthInTxHashToCctx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = append(m.CctxIndex, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipInTxHashToCctx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthInTxHashToCctx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipInTxHashToCctx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowInTxHashToCctx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowInTxHashToCctx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowInTxHashToCctx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthInTxHashToCctx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupInTxHashToCctx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthInTxHashToCctx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthInTxHashToCctx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowInTxHashToCctx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupInTxHashToCctx = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/in_tx_tracker.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type InTxTracker struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
CoinType common.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
}
func (m *InTxTracker) Reset() { *m = InTxTracker{} }
func (m *InTxTracker) String() string { return proto.CompactTextString(m) }
func (*InTxTracker) ProtoMessage() {}
func (*InTxTracker) Descriptor() ([]byte, []int) {
return fileDescriptor_799b411f065af0ce, []int{0}
}
func (m *InTxTracker) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *InTxTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_InTxTracker.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *InTxTracker) XXX_Merge(src proto.Message) {
xxx_messageInfo_InTxTracker.Merge(m, src)
}
func (m *InTxTracker) XXX_Size() int {
return m.Size()
}
func (m *InTxTracker) XXX_DiscardUnknown() {
xxx_messageInfo_InTxTracker.DiscardUnknown(m)
}
var xxx_messageInfo_InTxTracker proto.InternalMessageInfo
func (m *InTxTracker) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *InTxTracker) GetTxHash() string {
if m != nil {
return m.TxHash
}
return ""
}
func (m *InTxTracker) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func init() {
proto.RegisterType((*InTxTracker)(nil), "zetachain.zetacore.crosschain.InTxTracker")
}
func init() { proto.RegisterFile("crosschain/in_tx_tracker.proto", fileDescriptor_799b411f065af0ce) }
var fileDescriptor_799b411f065af0ce = []byte{
// 237 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x2e, 0xca, 0x2f,
0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0xcc, 0x8b, 0x2f, 0xa9, 0x88, 0x2f, 0x29, 0x4a,
0x4c, 0xce, 0x4e, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xad, 0x4a, 0x2d, 0x49,
0x04, 0x4b, 0xeb, 0x81, 0x59, 0xf9, 0x45, 0xa9, 0x7a, 0x08, 0x2d, 0x52, 0xc2, 0xc9, 0xf9, 0xb9,
0xb9, 0xf9, 0x79, 0xfa, 0x10, 0x0a, 0xa2, 0x47, 0xa9, 0x80, 0x8b, 0xdb, 0x33, 0x2f, 0xa4, 0x22,
0x04, 0x62, 0x90, 0x90, 0x24, 0x17, 0x07, 0x58, 0x71, 0x7c, 0x66, 0x8a, 0x04, 0xa3, 0x02, 0xa3,
0x06, 0x73, 0x10, 0x3b, 0x98, 0xef, 0x99, 0x22, 0x24, 0xce, 0xc5, 0x5e, 0x52, 0x11, 0x9f, 0x91,
0x58, 0x9c, 0x21, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x56, 0x52, 0xe1, 0x91, 0x58, 0x9c,
0x21, 0xa4, 0xcb, 0xc5, 0x99, 0x9c, 0x0f, 0x72, 0x4f, 0x65, 0x41, 0xaa, 0x04, 0xb3, 0x02, 0xa3,
0x06, 0x9f, 0x91, 0x80, 0x1e, 0xd4, 0x12, 0xe7, 0xfc, 0xcc, 0xbc, 0x90, 0xca, 0x82, 0xd4, 0x20,
0x8e, 0x64, 0x28, 0xcb, 0xc9, 0xfb, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c,
0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2,
0x0c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0x40, 0x7a, 0xf5, 0x41, 0x1e, 0xd0, 0x85, 0x78, 0x15,
0xe6, 0x17, 0xfd, 0x0a, 0x7d, 0xa4, 0x00, 0x00, 0xd9, 0x56, 0x9c, 0xc4, 0x06, 0xf6, 0x85, 0x31,
0x20, 0x00, 0x00, 0xff, 0xff, 0x60, 0xe9, 0x97, 0x6f, 0x1b, 0x01, 0x00, 0x00,
}
func (m *InTxTracker) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *InTxTracker) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *InTxTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.CoinType != 0 {
i = encodeVarintInTxTracker(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x18
}
if len(m.TxHash) > 0 {
i -= len(m.TxHash)
copy(dAtA[i:], m.TxHash)
i = encodeVarintInTxTracker(dAtA, i, uint64(len(m.TxHash)))
i--
dAtA[i] = 0x12
}
if m.ChainId != 0 {
i = encodeVarintInTxTracker(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintInTxTracker(dAtA []byte, offset int, v uint64) int {
offset -= sovInTxTracker(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *InTxTracker) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovInTxTracker(uint64(m.ChainId))
}
l = len(m.TxHash)
if l > 0 {
n += 1 + l + sovInTxTracker(uint64(l))
}
if m.CoinType != 0 {
n += 1 + sovInTxTracker(uint64(m.CoinType))
}
return n
}
func sovInTxTracker(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozInTxTracker(x uint64) (n int) {
return sovInTxTracker(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *InTxTracker) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowInTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: InTxTracker: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: InTxTracker: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowInTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowInTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthInTxTracker
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthInTxTracker
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowInTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipInTxTracker(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthInTxTracker
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipInTxTracker(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowInTxTracker
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowInTxTracker
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowInTxTracker
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthInTxTracker
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupInTxTracker
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthInTxTracker
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthInTxTracker = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowInTxTracker = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupInTxTracker = fmt.Errorf("proto: unexpected end of group")
)
package types
const (
// InTxHashToCctxKeyPrefix is the prefix to retrieve all InTxHashToCctx
InTxHashToCctxKeyPrefix = "InTxHashToCctx/value/"
)
// InTxHashToCctxKey returns the store key to retrieve a InTxHashToCctx from the index fields
func InTxHashToCctxKey(
inTxHash string,
) []byte {
var key []byte
inTxHashBytes := []byte(inTxHash)
key = append(key, inTxHashBytes...)
key = append(key, []byte("/")...)
return key
}
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/ethereum/go-ethereum/common"
)
const (
// ModuleName defines the module name
ModuleName = "crosschain"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey is the message route for slashing
RouterKey = ModuleName
// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_metacore"
ProtocolFee = 2000000000000000000
)
func GetProtocolFee() sdk.Uint {
return sdk.NewUint(ProtocolFee)
}
func KeyPrefix(p string) []byte {
return []byte(p)
}
const (
TxinKey = "Txin-value-"
TxinVoterKey = "TxinVoter-value-"
TxoutKey = "Txout-value-"
TxoutCountKey = "Txout-count-"
TxoutConfirmationKey = "TxoutConfirmation-value-"
SendKey = "Send-value-"
VoteCounterKey = "VoteCounter-value-"
ReceiveKey = "Receive-value-"
LastBlockHeightKey = "LastBlockHeight-value-"
ChainNoncesKey = "ChainNonces-value-"
GasPriceKey = "GasPrice-value-"
GasBalanceKey = "GasBalance-value-"
TSSKey = "TSS-value-"
TSSHistoryKey = "TSS-History-value-"
OutTxTrackerKeyPrefix = "OutTxTracker-value-"
InTxTrackerKeyPrefix = "InTxTracker-value-"
NonceToCctxKeyPrefix = "NonceToCctx-value-"
PendingNoncesKeyPrefix = "PendingNonces-value-"
)
// OutTxTrackerKey returns the store key to retrieve a OutTxTracker from the index fields
func OutTxTrackerKey(
index string,
) []byte {
var key []byte
indexBytes := []byte(index)
key = append(key, indexBytes...)
key = append(key, []byte("/")...)
return key
}
// TODO: what's the purpose of this log identifier?
func (m CrossChainTx) LogIdentifierForCCTX() string {
if len(m.OutboundTxParams) == 0 {
return fmt.Sprintf("%s-%d", m.InboundTxParams.Sender, m.InboundTxParams.SenderChainId)
}
i := len(m.OutboundTxParams) - 1
outTx := m.OutboundTxParams[i]
return fmt.Sprintf("%s-%d-%d-%d", m.InboundTxParams.Sender, m.InboundTxParams.SenderChainId, outTx.ReceiverChainId, outTx.OutboundTxTssNonce)
}
var (
ModuleAddress = authtypes.NewModuleAddress(ModuleName)
//ModuleAddressEVM common.EVMAddress
ModuleAddressEVM = common.BytesToAddress(ModuleAddress.Bytes())
//0xB73C0Aac4C1E606C6E495d848196355e6CB30381
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/last_block_height.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type LastBlockHeight struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Index string `protobuf:"bytes,2,opt,name=index,proto3" json:"index,omitempty"`
Chain string `protobuf:"bytes,3,opt,name=chain,proto3" json:"chain,omitempty"`
LastSendHeight uint64 `protobuf:"varint,4,opt,name=lastSendHeight,proto3" json:"lastSendHeight,omitempty"`
LastReceiveHeight uint64 `protobuf:"varint,5,opt,name=lastReceiveHeight,proto3" json:"lastReceiveHeight,omitempty"`
}
func (m *LastBlockHeight) Reset() { *m = LastBlockHeight{} }
func (m *LastBlockHeight) String() string { return proto.CompactTextString(m) }
func (*LastBlockHeight) ProtoMessage() {}
func (*LastBlockHeight) Descriptor() ([]byte, []int) {
return fileDescriptor_a66188d8895bda91, []int{0}
}
func (m *LastBlockHeight) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LastBlockHeight) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LastBlockHeight.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LastBlockHeight) XXX_Merge(src proto.Message) {
xxx_messageInfo_LastBlockHeight.Merge(m, src)
}
func (m *LastBlockHeight) XXX_Size() int {
return m.Size()
}
func (m *LastBlockHeight) XXX_DiscardUnknown() {
xxx_messageInfo_LastBlockHeight.DiscardUnknown(m)
}
var xxx_messageInfo_LastBlockHeight proto.InternalMessageInfo
func (m *LastBlockHeight) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *LastBlockHeight) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *LastBlockHeight) GetChain() string {
if m != nil {
return m.Chain
}
return ""
}
func (m *LastBlockHeight) GetLastSendHeight() uint64 {
if m != nil {
return m.LastSendHeight
}
return 0
}
func (m *LastBlockHeight) GetLastReceiveHeight() uint64 {
if m != nil {
return m.LastReceiveHeight
}
return 0
}
func init() {
proto.RegisterType((*LastBlockHeight)(nil), "zetachain.zetacore.crosschain.LastBlockHeight")
}
func init() {
proto.RegisterFile("crosschain/last_block_height.proto", fileDescriptor_a66188d8895bda91)
}
var fileDescriptor_a66188d8895bda91 = []byte{
// 241 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x2e, 0xca, 0x2f,
0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0x49, 0x2c, 0x2e, 0x89, 0x4f, 0xca, 0xc9, 0x4f,
0xce, 0x8e, 0xcf, 0x48, 0xcd, 0x4c, 0xcf, 0x28, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92,
0xad, 0x4a, 0x2d, 0x49, 0x04, 0x2b, 0xd1, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x10, 0xda, 0x94,
0xd6, 0x32, 0x72, 0xf1, 0xfb, 0x24, 0x16, 0x97, 0x38, 0x81, 0x74, 0x7a, 0x80, 0x35, 0x0a, 0x49,
0x70, 0xb1, 0x27, 0x17, 0xa5, 0x26, 0x96, 0xe4, 0x17, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06,
0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x99, 0x79, 0x29, 0xa9, 0x15, 0x12, 0x4c, 0x60, 0x71, 0x08,
0x07, 0x24, 0x0a, 0x36, 0x4c, 0x82, 0x19, 0x22, 0x0a, 0xe6, 0x08, 0xa9, 0x71, 0xf1, 0x81, 0xdc,
0x14, 0x9c, 0x9a, 0x97, 0x02, 0x31, 0x57, 0x82, 0x45, 0x81, 0x51, 0x83, 0x25, 0x08, 0x4d, 0x54,
0x48, 0x87, 0x4b, 0x10, 0x24, 0x12, 0x94, 0x9a, 0x9c, 0x9a, 0x59, 0x96, 0x0a, 0x55, 0xca, 0x0a,
0x56, 0x8a, 0x29, 0xe1, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e,
0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51,
0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x9f, 0xea, 0x42,
0xc2, 0x05, 0xe6, 0x69, 0xfd, 0x0a, 0x7d, 0xa4, 0xd0, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62,
0x03, 0x07, 0x91, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x07, 0x28, 0xe0, 0x48, 0x01, 0x00,
0x00,
}
func (m *LastBlockHeight) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *LastBlockHeight) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LastBlockHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.LastReceiveHeight != 0 {
i = encodeVarintLastBlockHeight(dAtA, i, uint64(m.LastReceiveHeight))
i--
dAtA[i] = 0x28
}
if m.LastSendHeight != 0 {
i = encodeVarintLastBlockHeight(dAtA, i, uint64(m.LastSendHeight))
i--
dAtA[i] = 0x20
}
if len(m.Chain) > 0 {
i -= len(m.Chain)
copy(dAtA[i:], m.Chain)
i = encodeVarintLastBlockHeight(dAtA, i, uint64(len(m.Chain)))
i--
dAtA[i] = 0x1a
}
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintLastBlockHeight(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintLastBlockHeight(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintLastBlockHeight(dAtA []byte, offset int, v uint64) int {
offset -= sovLastBlockHeight(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *LastBlockHeight) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovLastBlockHeight(uint64(l))
}
l = len(m.Index)
if l > 0 {
n += 1 + l + sovLastBlockHeight(uint64(l))
}
l = len(m.Chain)
if l > 0 {
n += 1 + l + sovLastBlockHeight(uint64(l))
}
if m.LastSendHeight != 0 {
n += 1 + sovLastBlockHeight(uint64(m.LastSendHeight))
}
if m.LastReceiveHeight != 0 {
n += 1 + sovLastBlockHeight(uint64(m.LastReceiveHeight))
}
return n
}
func sovLastBlockHeight(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozLastBlockHeight(x uint64) (n int) {
return sovLastBlockHeight(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *LastBlockHeight) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: LastBlockHeight: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LastBlockHeight: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthLastBlockHeight
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthLastBlockHeight
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthLastBlockHeight
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthLastBlockHeight
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthLastBlockHeight
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthLastBlockHeight
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Chain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastSendHeight", wireType)
}
m.LastSendHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LastSendHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastReceiveHeight", wireType)
}
m.LastReceiveHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LastReceiveHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipLastBlockHeight(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthLastBlockHeight
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipLastBlockHeight(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowLastBlockHeight
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthLastBlockHeight
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupLastBlockHeight
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthLastBlockHeight
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthLastBlockHeight = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowLastBlockHeight = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupLastBlockHeight = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
const TypeMsgAddToInTxTracker = "AddToInTxTracker"
var _ sdk.Msg = &MsgAddToInTxTracker{}
func NewMsgAddToInTxTracker(creator string, chain int64, coinType common.CoinType, txHash string) *MsgAddToInTxTracker {
return &MsgAddToInTxTracker{
Creator: creator,
ChainId: chain,
TxHash: txHash,
CoinType: coinType,
}
}
func (msg *MsgAddToInTxTracker) Route() string {
return RouterKey
}
func (msg *MsgAddToInTxTracker) Type() string {
return TypeMsgAddToInTxTracker
}
func (msg *MsgAddToInTxTracker) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgAddToInTxTracker) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgAddToInTxTracker) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
chain := common.GetChainFromChainID(msg.ChainId)
if chain == nil {
return errorsmod.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId)
}
if msg.Proof != nil && !chain.SupportMerkleProof() {
return errorsmod.Wrapf(ErrProofVerificationFail, "chain id %d does not support proof-based trackers", msg.ChainId)
}
_, ok := common.CoinType_value[msg.CoinType.String()]
if !ok {
return errorsmod.Wrapf(ErrProofVerificationFail, "coin-type not supported")
}
return nil
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
const TypeMsgAddToOutTxTracker = "AddToTracker"
var _ sdk.Msg = &MsgAddToOutTxTracker{}
func NewMsgAddToOutTxTracker(
creator string,
chain int64,
nonce uint64,
txHash string,
proof *common.Proof,
blockHash string,
txIndex int64,
) *MsgAddToOutTxTracker {
return &MsgAddToOutTxTracker{
Creator: creator,
ChainId: chain,
Nonce: nonce,
TxHash: txHash,
Proof: proof,
BlockHash: blockHash,
TxIndex: txIndex,
}
}
func (msg *MsgAddToOutTxTracker) Route() string {
return RouterKey
}
func (msg *MsgAddToOutTxTracker) Type() string {
return TypeMsgAddToOutTxTracker
}
func (msg *MsgAddToOutTxTracker) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgAddToOutTxTracker) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgAddToOutTxTracker) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.ChainId < 0 {
return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId)
}
return nil
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
var _ sdk.Msg = &MsgGasPriceVoter{}
func NewMsgGasPriceVoter(creator string, chain int64, price uint64, supply string, blockNumber uint64) *MsgGasPriceVoter {
return &MsgGasPriceVoter{
Creator: creator,
ChainId: chain,
Price: price,
BlockNumber: blockNumber,
Supply: supply,
}
}
func (msg *MsgGasPriceVoter) Route() string {
return RouterKey
}
func (msg *MsgGasPriceVoter) Type() string {
return common.GasPriceVoter.String()
}
func (msg *MsgGasPriceVoter) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgGasPriceVoter) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgGasPriceVoter) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.ChainId < 0 {
return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId)
}
return nil
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
var _ sdk.Msg = &MsgNonceVoter{}
func NewMsgNonceVoter(creator string, chain int64, nonce uint64) *MsgNonceVoter {
return &MsgNonceVoter{
Creator: creator,
ChainId: chain,
Nonce: nonce,
}
}
func (msg *MsgNonceVoter) Route() string {
return RouterKey
}
func (msg *MsgNonceVoter) Type() string {
return common.NonceVoter.String()
}
func (msg *MsgNonceVoter) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgNonceVoter) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgNonceVoter) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.ChainId < 0 {
return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId)
}
return nil
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgRemoveFromOutTxTracker = "RemoveFromTracker"
var _ sdk.Msg = &MsgRemoveFromOutTxTracker{}
func NewMsgRemoveFromOutTxTracker(creator string, chain int64, nonce uint64) *MsgRemoveFromOutTxTracker {
return &MsgRemoveFromOutTxTracker{
Creator: creator,
ChainId: chain,
Nonce: nonce,
}
}
func (msg *MsgRemoveFromOutTxTracker) Route() string {
return RouterKey
}
func (msg *MsgRemoveFromOutTxTracker) Type() string {
return TypeMsgRemoveFromOutTxTracker
}
func (msg *MsgRemoveFromOutTxTracker) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgRemoveFromOutTxTracker) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgRemoveFromOutTxTracker) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.ChainId < 0 {
return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId)
}
return nil
}
package types
import (
"bytes"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/common/cosmos"
)
var _ sdk.Msg = &MsgSetNodeKeys{}
func NewMsgSetNodeKeys(creator string, pubkeySet common.PubKeySet, tssSignerAddress string) *MsgSetNodeKeys {
return &MsgSetNodeKeys{
Creator: creator,
PubkeySet: &pubkeySet,
TssSigner_Address: tssSignerAddress,
}
}
func (msg *MsgSetNodeKeys) Route() string {
return RouterKey
}
func (msg *MsgSetNodeKeys) Type() string {
return "SetNodeKeys"
}
func (msg *MsgSetNodeKeys) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgSetNodeKeys) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgSetNodeKeys) ValidateBasic() error {
accAddressCreator, err := sdk.AccAddressFromBech32(msg.TssSigner_Address)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid tss signer address (%s)", err)
}
pubkey, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, msg.PubkeySet.Secp256k1.String())
if err != nil {
return sdkerrors.Wrapf(ErrInvalidPubKeySet, err.Error())
}
if bytes.Compare(accAddressCreator.Bytes(), pubkey.Address().Bytes()) != 0 {
return sdkerrors.Wrapf(ErrInvalidPubKeySet, fmt.Sprintf("Creator : %s , PubkeySet %s", accAddressCreator.String(), pubkey.Address().String()))
}
_, err = sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}
package types
import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/crypto"
"github.com/zeta-chain/zetacore/common"
)
// MaxMessageLength is the maximum length of a message in a cctx
// TODO: should parameterize the hardcoded max len
// FIXME: should allow this observation and handle errors in the state machine
// https://github.com/zeta-chain/node/issues/862
const MaxMessageLength = 10240
var _ sdk.Msg = &MsgVoteOnObservedInboundTx{}
func NewMsgVoteOnObservedInboundTx(
creator,
sender string,
senderChain int64,
txOrigin,
receiver string,
receiverChain int64,
amount math.Uint,
message,
inTxHash string,
inBlockHeight,
gasLimit uint64,
coinType common.CoinType,
asset string,
) *MsgVoteOnObservedInboundTx {
return &MsgVoteOnObservedInboundTx{
Creator: creator,
Sender: sender,
SenderChainId: senderChain,
TxOrigin: txOrigin,
Receiver: receiver,
ReceiverChain: receiverChain,
Amount: amount,
Message: message,
InTxHash: inTxHash,
InBlockHeight: inBlockHeight,
GasLimit: gasLimit,
CoinType: coinType,
Asset: asset,
}
}
func (msg *MsgVoteOnObservedInboundTx) Route() string {
return RouterKey
}
func (msg *MsgVoteOnObservedInboundTx) Type() string {
return common.InboundVoter.String()
}
func (msg *MsgVoteOnObservedInboundTx) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgVoteOnObservedInboundTx) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgVoteOnObservedInboundTx) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s): %s", err, msg.Creator)
}
if msg.SenderChainId < 0 {
return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.SenderChainId)
}
if msg.ReceiverChain < 0 {
return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ReceiverChain)
}
if len(msg.Message) > MaxMessageLength {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "message is too long: %d", len(msg.Message))
}
return nil
}
func (msg *MsgVoteOnObservedInboundTx) Digest() string {
m := *msg
m.Creator = ""
m.InBlockHeight = 0
hash := crypto.Keccak256Hash([]byte(m.String()))
return hash.Hex()
}
package types
import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/crypto"
"github.com/zeta-chain/zetacore/common"
)
var _ sdk.Msg = &MsgVoteOnObservedOutboundTx{}
func NewMsgVoteOnObservedOutboundTx(
creator,
sendHash,
outTxHash string,
outBlockHeight,
outTxGasUsed uint64,
outTxEffectiveGasPrice math.Int,
outTxEffectiveGasLimit uint64,
valueReceived math.Uint,
status common.ReceiveStatus,
chain int64,
nonce uint64,
coinType common.CoinType,
) *MsgVoteOnObservedOutboundTx {
return &MsgVoteOnObservedOutboundTx{
Creator: creator,
CctxHash: sendHash,
ObservedOutTxHash: outTxHash,
ObservedOutTxBlockHeight: outBlockHeight,
ObservedOutTxGasUsed: outTxGasUsed,
ObservedOutTxEffectiveGasPrice: outTxEffectiveGasPrice,
ObservedOutTxEffectiveGasLimit: outTxEffectiveGasLimit,
ValueReceived: valueReceived,
Status: status,
OutTxChain: chain,
OutTxTssNonce: nonce,
CoinType: coinType,
}
}
func (msg *MsgVoteOnObservedOutboundTx) Route() string {
return RouterKey
}
func (msg *MsgVoteOnObservedOutboundTx) Type() string {
return common.OutboundVoter.String()
}
func (msg *MsgVoteOnObservedOutboundTx) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgVoteOnObservedOutboundTx) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgVoteOnObservedOutboundTx) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.OutTxChain < 0 {
return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.OutTxChain)
}
return nil
}
func (msg *MsgVoteOnObservedOutboundTx) Digest() string {
m := *msg
m.Creator = ""
// Set status to ReceiveStatus_Created to make sure both successful and failed votes are added to the same ballot
m.Status = common.ReceiveStatus_Created
// Outbound and reverted txs have different digest as ObservedOutTxHash is different so they are stored in different ballots
hash := crypto.Keccak256Hash([]byte(m.String()))
return hash.Hex()
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
const TypeMsgWhitelistERC20 = "whitelist_erc20"
var _ sdk.Msg = &MsgWhitelistERC20{}
func NewMsgWhitelistERC20(
creator string, erc20Address string, chainID int64, name string,
symbol string, decimals uint32, gasLimit int64) *MsgWhitelistERC20 {
return &MsgWhitelistERC20{
Creator: creator,
Erc20Address: erc20Address,
ChainId: chainID,
Name: name,
Symbol: symbol,
Decimals: decimals,
GasLimit: gasLimit,
}
}
func (msg *MsgWhitelistERC20) Route() string {
return types.RouterKey
}
func (msg *MsgWhitelistERC20) Type() string {
return TypeMsgWhitelistERC20
}
func (msg *MsgWhitelistERC20) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgWhitelistERC20) GetSignBytes() []byte {
bz := types.ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgWhitelistERC20) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
// check if the system contract address is valid
if ethcommon.HexToAddress(msg.Erc20Address) == (ethcommon.Address{}) {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid ERC20 contract address (%s)", msg.Erc20Address)
}
if msg.Decimals > 128 {
return sdkerrors.Wrapf(types.ErrInvalidDecimals, "invalid decimals (%d)", msg.Decimals)
}
if msg.GasLimit <= 0 {
return sdkerrors.Wrapf(types.ErrInvalidGasLimit, "invalid gas limit (%d)", msg.GasLimit)
}
return nil
}
package types
import (
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
var _ sdk.Msg = &MsgMigrateTssFunds{}
func NewMsgMigrateTssFunds(creator string, chainID int64, amount sdkmath.Uint) *MsgMigrateTssFunds {
return &MsgMigrateTssFunds{
Creator: creator,
ChainId: chainID,
Amount: amount,
}
}
func (msg *MsgMigrateTssFunds) Route() string {
return RouterKey
}
func (msg *MsgMigrateTssFunds) Type() string {
return "MigrateTssFunds"
}
func (msg *MsgMigrateTssFunds) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgMigrateTssFunds) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgMigrateTssFunds) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if common.GetChainFromChainID(msg.ChainId) == nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain id (%d)", msg.ChainId)
}
if msg.Amount.IsZero() {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "amount cannot be zero")
}
return nil
}
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
var _ sdk.Msg = &MsgCreateTSSVoter{}
func NewMsgCreateTSSVoter(creator string, pubkey string, keygenZetaHeight int64, status common.ReceiveStatus) *MsgCreateTSSVoter {
return &MsgCreateTSSVoter{
Creator: creator,
TssPubkey: pubkey,
KeyGenZetaHeight: keygenZetaHeight,
Status: status,
}
}
func (msg *MsgCreateTSSVoter) Route() string {
return RouterKey
}
func (msg *MsgCreateTSSVoter) Type() string {
return "CreateTSSVoter"
}
func (msg *MsgCreateTSSVoter) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgCreateTSSVoter) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgCreateTSSVoter) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}
func (msg *MsgCreateTSSVoter) Digest() string {
// We support only 1 keygen at a particular height
return fmt.Sprintf("%d-%s", msg.KeyGenZetaHeight, "tss-keygen")
}
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common/cosmos"
)
var _ sdk.Msg = &MsgUpdateTssAddress{}
func NewMsgUpdateTssAddress(creator string, pubkey string) *MsgUpdateTssAddress {
return &MsgUpdateTssAddress{
Creator: creator,
TssPubkey: pubkey,
}
}
func (msg *MsgUpdateTssAddress) Route() string {
return RouterKey
}
func (msg *MsgUpdateTssAddress) Type() string {
return "UpdateTssAddress"
}
func (msg *MsgUpdateTssAddress) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateTssAddress) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateTssAddress) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
_, err = cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, msg.TssPubkey)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid tss pubkey (%s)", err)
}
return nil
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/nonce_to_cctx.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// store key is tss+chainid+nonce
type NonceToCctx struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Nonce int64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
CctxIndex string `protobuf:"bytes,3,opt,name=cctxIndex,proto3" json:"cctxIndex,omitempty"`
Tss string `protobuf:"bytes,4,opt,name=tss,proto3" json:"tss,omitempty"`
}
func (m *NonceToCctx) Reset() { *m = NonceToCctx{} }
func (m *NonceToCctx) String() string { return proto.CompactTextString(m) }
func (*NonceToCctx) ProtoMessage() {}
func (*NonceToCctx) Descriptor() ([]byte, []int) {
return fileDescriptor_cfa802a2474dc9c1, []int{0}
}
func (m *NonceToCctx) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *NonceToCctx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_NonceToCctx.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *NonceToCctx) XXX_Merge(src proto.Message) {
xxx_messageInfo_NonceToCctx.Merge(m, src)
}
func (m *NonceToCctx) XXX_Size() int {
return m.Size()
}
func (m *NonceToCctx) XXX_DiscardUnknown() {
xxx_messageInfo_NonceToCctx.DiscardUnknown(m)
}
var xxx_messageInfo_NonceToCctx proto.InternalMessageInfo
func (m *NonceToCctx) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *NonceToCctx) GetNonce() int64 {
if m != nil {
return m.Nonce
}
return 0
}
func (m *NonceToCctx) GetCctxIndex() string {
if m != nil {
return m.CctxIndex
}
return ""
}
func (m *NonceToCctx) GetTss() string {
if m != nil {
return m.Tss
}
return ""
}
// store key is tss+chainid
type PendingNonces struct {
NonceLow int64 `protobuf:"varint,1,opt,name=nonce_low,json=nonceLow,proto3" json:"nonce_low,omitempty"`
NonceHigh int64 `protobuf:"varint,2,opt,name=nonce_high,json=nonceHigh,proto3" json:"nonce_high,omitempty"`
ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Tss string `protobuf:"bytes,4,opt,name=tss,proto3" json:"tss,omitempty"`
}
func (m *PendingNonces) Reset() { *m = PendingNonces{} }
func (m *PendingNonces) String() string { return proto.CompactTextString(m) }
func (*PendingNonces) ProtoMessage() {}
func (*PendingNonces) Descriptor() ([]byte, []int) {
return fileDescriptor_cfa802a2474dc9c1, []int{1}
}
func (m *PendingNonces) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *PendingNonces) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_PendingNonces.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *PendingNonces) XXX_Merge(src proto.Message) {
xxx_messageInfo_PendingNonces.Merge(m, src)
}
func (m *PendingNonces) XXX_Size() int {
return m.Size()
}
func (m *PendingNonces) XXX_DiscardUnknown() {
xxx_messageInfo_PendingNonces.DiscardUnknown(m)
}
var xxx_messageInfo_PendingNonces proto.InternalMessageInfo
func (m *PendingNonces) GetNonceLow() int64 {
if m != nil {
return m.NonceLow
}
return 0
}
func (m *PendingNonces) GetNonceHigh() int64 {
if m != nil {
return m.NonceHigh
}
return 0
}
func (m *PendingNonces) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *PendingNonces) GetTss() string {
if m != nil {
return m.Tss
}
return ""
}
func init() {
proto.RegisterType((*NonceToCctx)(nil), "zetachain.zetacore.crosschain.NonceToCctx")
proto.RegisterType((*PendingNonces)(nil), "zetachain.zetacore.crosschain.PendingNonces")
}
func init() { proto.RegisterFile("crosschain/nonce_to_cctx.proto", fileDescriptor_cfa802a2474dc9c1) }
var fileDescriptor_cfa802a2474dc9c1 = []byte{
// 273 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x2e, 0xca, 0x2f,
0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0xcb, 0xcf, 0x4b, 0x4e, 0x8d, 0x2f, 0xc9, 0x8f,
0x4f, 0x4e, 0x2e, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xad, 0x4a, 0x2d, 0x49,
0x04, 0x4b, 0xeb, 0x81, 0x59, 0xf9, 0x45, 0xa9, 0x7a, 0x08, 0x2d, 0x4a, 0x79, 0x5c, 0xdc, 0x7e,
0x20, 0x5d, 0x21, 0xf9, 0xce, 0xc9, 0x25, 0x15, 0x42, 0x92, 0x5c, 0x1c, 0x60, 0xf1, 0xf8, 0xcc,
0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x76, 0x30, 0xdf, 0x33, 0x45, 0x48, 0x84, 0x8b,
0x15, 0x6c, 0xbe, 0x04, 0x13, 0x58, 0x1c, 0xc2, 0x11, 0x92, 0xe1, 0xe2, 0x04, 0x59, 0xe6, 0x99,
0x97, 0x92, 0x5a, 0x21, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0x19, 0x84, 0x10, 0x10, 0x12, 0xe0, 0x62,
0x2e, 0x29, 0x2e, 0x96, 0x60, 0x01, 0x8b, 0x83, 0x98, 0x4a, 0x15, 0x5c, 0xbc, 0x01, 0xa9, 0x79,
0x29, 0x99, 0x79, 0xe9, 0x60, 0x6b, 0x8b, 0x85, 0xa4, 0xb9, 0x38, 0x21, 0xce, 0xce, 0xc9, 0x2f,
0x87, 0x5a, 0xc9, 0x01, 0x16, 0xf0, 0xc9, 0x2f, 0x17, 0x92, 0xe5, 0xe2, 0x82, 0x48, 0x66, 0x64,
0xa6, 0x67, 0x40, 0x2d, 0x86, 0x28, 0xf7, 0xc8, 0x4c, 0xcf, 0x40, 0x71, 0x2d, 0x33, 0xaa, 0x6b,
0x31, 0x6c, 0x76, 0xf2, 0x3e, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4,
0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xc3,
0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x50, 0x18, 0xe9, 0x42, 0x42,
0x13, 0x16, 0x5c, 0xfa, 0x15, 0xfa, 0x48, 0x61, 0x5c, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06,
0x0e, 0x5c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xcb, 0x3e, 0xac, 0x7e, 0x01, 0x00,
0x00,
}
func (m *NonceToCctx) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *NonceToCctx) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *NonceToCctx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Tss) > 0 {
i -= len(m.Tss)
copy(dAtA[i:], m.Tss)
i = encodeVarintNonceToCctx(dAtA, i, uint64(len(m.Tss)))
i--
dAtA[i] = 0x22
}
if len(m.CctxIndex) > 0 {
i -= len(m.CctxIndex)
copy(dAtA[i:], m.CctxIndex)
i = encodeVarintNonceToCctx(dAtA, i, uint64(len(m.CctxIndex)))
i--
dAtA[i] = 0x1a
}
if m.Nonce != 0 {
i = encodeVarintNonceToCctx(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x10
}
if m.ChainId != 0 {
i = encodeVarintNonceToCctx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *PendingNonces) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *PendingNonces) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PendingNonces) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Tss) > 0 {
i -= len(m.Tss)
copy(dAtA[i:], m.Tss)
i = encodeVarintNonceToCctx(dAtA, i, uint64(len(m.Tss)))
i--
dAtA[i] = 0x22
}
if m.ChainId != 0 {
i = encodeVarintNonceToCctx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x18
}
if m.NonceHigh != 0 {
i = encodeVarintNonceToCctx(dAtA, i, uint64(m.NonceHigh))
i--
dAtA[i] = 0x10
}
if m.NonceLow != 0 {
i = encodeVarintNonceToCctx(dAtA, i, uint64(m.NonceLow))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintNonceToCctx(dAtA []byte, offset int, v uint64) int {
offset -= sovNonceToCctx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *NonceToCctx) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovNonceToCctx(uint64(m.ChainId))
}
if m.Nonce != 0 {
n += 1 + sovNonceToCctx(uint64(m.Nonce))
}
l = len(m.CctxIndex)
if l > 0 {
n += 1 + l + sovNonceToCctx(uint64(l))
}
l = len(m.Tss)
if l > 0 {
n += 1 + l + sovNonceToCctx(uint64(l))
}
return n
}
func (m *PendingNonces) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.NonceLow != 0 {
n += 1 + sovNonceToCctx(uint64(m.NonceLow))
}
if m.NonceHigh != 0 {
n += 1 + sovNonceToCctx(uint64(m.NonceHigh))
}
if m.ChainId != 0 {
n += 1 + sovNonceToCctx(uint64(m.ChainId))
}
l = len(m.Tss)
if l > 0 {
n += 1 + l + sovNonceToCctx(uint64(l))
}
return n
}
func sovNonceToCctx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozNonceToCctx(x uint64) (n int) {
return sovNonceToCctx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *NonceToCctx) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: NonceToCctx: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: NonceToCctx: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNonceToCctx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthNonceToCctx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Tss", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNonceToCctx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthNonceToCctx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Tss = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipNonceToCctx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthNonceToCctx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *PendingNonces) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: PendingNonces: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: PendingNonces: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NonceLow", wireType)
}
m.NonceLow = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NonceLow |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NonceHigh", wireType)
}
m.NonceHigh = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NonceHigh |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Tss", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNonceToCctx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthNonceToCctx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Tss = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipNonceToCctx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthNonceToCctx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipNonceToCctx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNonceToCctx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthNonceToCctx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupNonceToCctx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthNonceToCctx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthNonceToCctx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowNonceToCctx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupNonceToCctx = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/out_tx_tracker.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type TxHashList struct {
TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
TxSigner string `protobuf:"bytes,2,opt,name=tx_signer,json=txSigner,proto3" json:"tx_signer,omitempty"`
Proved bool `protobuf:"varint,3,opt,name=proved,proto3" json:"proved,omitempty"`
}
func (m *TxHashList) Reset() { *m = TxHashList{} }
func (m *TxHashList) String() string { return proto.CompactTextString(m) }
func (*TxHashList) ProtoMessage() {}
func (*TxHashList) Descriptor() ([]byte, []int) {
return fileDescriptor_5638c11005e4d36d, []int{0}
}
func (m *TxHashList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TxHashList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TxHashList.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *TxHashList) XXX_Merge(src proto.Message) {
xxx_messageInfo_TxHashList.Merge(m, src)
}
func (m *TxHashList) XXX_Size() int {
return m.Size()
}
func (m *TxHashList) XXX_DiscardUnknown() {
xxx_messageInfo_TxHashList.DiscardUnknown(m)
}
var xxx_messageInfo_TxHashList proto.InternalMessageInfo
func (m *TxHashList) GetTxHash() string {
if m != nil {
return m.TxHash
}
return ""
}
func (m *TxHashList) GetTxSigner() string {
if m != nil {
return m.TxSigner
}
return ""
}
func (m *TxHashList) GetProved() bool {
if m != nil {
return m.Proved
}
return false
}
type OutTxTracker struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
HashList []*TxHashList `protobuf:"bytes,4,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"`
}
func (m *OutTxTracker) Reset() { *m = OutTxTracker{} }
func (m *OutTxTracker) String() string { return proto.CompactTextString(m) }
func (*OutTxTracker) ProtoMessage() {}
func (*OutTxTracker) Descriptor() ([]byte, []int) {
return fileDescriptor_5638c11005e4d36d, []int{1}
}
func (m *OutTxTracker) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *OutTxTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_OutTxTracker.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *OutTxTracker) XXX_Merge(src proto.Message) {
xxx_messageInfo_OutTxTracker.Merge(m, src)
}
func (m *OutTxTracker) XXX_Size() int {
return m.Size()
}
func (m *OutTxTracker) XXX_DiscardUnknown() {
xxx_messageInfo_OutTxTracker.DiscardUnknown(m)
}
var xxx_messageInfo_OutTxTracker proto.InternalMessageInfo
func (m *OutTxTracker) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *OutTxTracker) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *OutTxTracker) GetNonce() uint64 {
if m != nil {
return m.Nonce
}
return 0
}
func (m *OutTxTracker) GetHashList() []*TxHashList {
if m != nil {
return m.HashList
}
return nil
}
func init() {
proto.RegisterType((*TxHashList)(nil), "zetachain.zetacore.crosschain.TxHashList")
proto.RegisterType((*OutTxTracker)(nil), "zetachain.zetacore.crosschain.OutTxTracker")
}
func init() { proto.RegisterFile("crosschain/out_tx_tracker.proto", fileDescriptor_5638c11005e4d36d) }
var fileDescriptor_5638c11005e4d36d = []byte{
// 299 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4e, 0xeb, 0x30,
0x14, 0x86, 0xeb, 0xdb, 0xde, 0x36, 0x35, 0x4c, 0x16, 0x82, 0x20, 0x84, 0xa9, 0x3a, 0x95, 0x01,
0x47, 0xc0, 0x1b, 0x30, 0x20, 0x10, 0x48, 0x48, 0xa1, 0x53, 0x17, 0x2b, 0x4d, 0xac, 0xda, 0x02,
0xe2, 0xc8, 0x3e, 0x41, 0x86, 0xa7, 0xe0, 0x05, 0x78, 0x1f, 0xc6, 0x8e, 0x8c, 0x28, 0x79, 0x11,
0x14, 0x27, 0xa8, 0x4c, 0x6c, 0xe7, 0xd3, 0xd1, 0xf9, 0xf4, 0x9f, 0x1f, 0x1f, 0xa5, 0x46, 0x5b,
0x9b, 0xca, 0x44, 0xe5, 0x91, 0x2e, 0x81, 0x83, 0xe3, 0x60, 0x92, 0xf4, 0x41, 0x18, 0x56, 0x18,
0x0d, 0x9a, 0x1c, 0xbe, 0x0a, 0x48, 0xfc, 0x9e, 0xf9, 0x49, 0x1b, 0xc1, 0x36, 0x37, 0xd3, 0x05,
0xc6, 0x73, 0x77, 0x95, 0x58, 0x79, 0xab, 0x2c, 0x90, 0x3d, 0x3c, 0x02, 0xc7, 0x65, 0x62, 0x65,
0x88, 0x26, 0x68, 0x36, 0x8e, 0x87, 0xe0, 0x97, 0xe4, 0x00, 0x8f, 0xc1, 0x71, 0xab, 0x56, 0xb9,
0x30, 0xe1, 0x3f, 0xbf, 0x0a, 0xc0, 0xdd, 0x7b, 0x26, 0xbb, 0x78, 0x58, 0x18, 0xfd, 0x2c, 0xb2,
0xb0, 0x3f, 0x41, 0xb3, 0x20, 0xee, 0x68, 0xfa, 0x8e, 0xf0, 0xf6, 0x5d, 0x09, 0x73, 0x37, 0x6f,
0x13, 0x91, 0x1d, 0xfc, 0x5f, 0xe5, 0x99, 0x70, 0x9d, 0xbc, 0x05, 0xb2, 0x8f, 0x03, 0x9f, 0x85,
0xab, 0xcc, 0xab, 0xfb, 0xf1, 0xc8, 0xf3, 0x75, 0xd6, 0x1c, 0xe4, 0x3a, 0x4f, 0x85, 0x17, 0x0f,
0xe2, 0x16, 0xc8, 0x25, 0x1e, 0x37, 0x11, 0xf9, 0xa3, 0xb2, 0x10, 0x0e, 0x26, 0xfd, 0xd9, 0xd6,
0xd9, 0x31, 0xfb, 0xf3, 0x4d, 0xb6, 0xf9, 0x31, 0x0e, 0x64, 0x37, 0x5d, 0xdc, 0x7c, 0x54, 0x14,
0xad, 0x2b, 0x8a, 0xbe, 0x2a, 0x8a, 0xde, 0x6a, 0xda, 0x5b, 0xd7, 0xb4, 0xf7, 0x59, 0xd3, 0xde,
0xe2, 0x74, 0xa5, 0x40, 0x96, 0x4b, 0x96, 0xea, 0xa7, 0xa8, 0xd1, 0x9d, 0xb4, 0x05, 0xff, 0x98,
0x23, 0x17, 0xfd, 0xaa, 0x1d, 0x5e, 0x0a, 0x61, 0x97, 0x43, 0x5f, 0xf7, 0xf9, 0x77, 0x00, 0x00,
0x00, 0xff, 0xff, 0x0c, 0x73, 0x3d, 0x85, 0x91, 0x01, 0x00, 0x00,
}
func (m *TxHashList) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *TxHashList) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TxHashList) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Proved {
i--
if m.Proved {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
}
if len(m.TxSigner) > 0 {
i -= len(m.TxSigner)
copy(dAtA[i:], m.TxSigner)
i = encodeVarintOutTxTracker(dAtA, i, uint64(len(m.TxSigner)))
i--
dAtA[i] = 0x12
}
if len(m.TxHash) > 0 {
i -= len(m.TxHash)
copy(dAtA[i:], m.TxHash)
i = encodeVarintOutTxTracker(dAtA, i, uint64(len(m.TxHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *OutTxTracker) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *OutTxTracker) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *OutTxTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.HashList) > 0 {
for iNdEx := len(m.HashList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.HashList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintOutTxTracker(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
}
if m.Nonce != 0 {
i = encodeVarintOutTxTracker(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x18
}
if m.ChainId != 0 {
i = encodeVarintOutTxTracker(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintOutTxTracker(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintOutTxTracker(dAtA []byte, offset int, v uint64) int {
offset -= sovOutTxTracker(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *TxHashList) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.TxHash)
if l > 0 {
n += 1 + l + sovOutTxTracker(uint64(l))
}
l = len(m.TxSigner)
if l > 0 {
n += 1 + l + sovOutTxTracker(uint64(l))
}
if m.Proved {
n += 2
}
return n
}
func (m *OutTxTracker) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovOutTxTracker(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovOutTxTracker(uint64(m.ChainId))
}
if m.Nonce != 0 {
n += 1 + sovOutTxTracker(uint64(m.Nonce))
}
if len(m.HashList) > 0 {
for _, e := range m.HashList {
l = e.Size()
n += 1 + l + sovOutTxTracker(uint64(l))
}
}
return n
}
func sovOutTxTracker(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozOutTxTracker(x uint64) (n int) {
return sovOutTxTracker(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *TxHashList) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: TxHashList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TxHashList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthOutTxTracker
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthOutTxTracker
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxSigner", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthOutTxTracker
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthOutTxTracker
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxSigner = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Proved", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Proved = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipOutTxTracker(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthOutTxTracker
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *OutTxTracker) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: OutTxTracker: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: OutTxTracker: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthOutTxTracker
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthOutTxTracker
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field HashList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthOutTxTracker
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthOutTxTracker
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.HashList = append(m.HashList, &TxHashList{})
if err := m.HashList[len(m.HashList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipOutTxTracker(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthOutTxTracker
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipOutTxTracker(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowOutTxTracker
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthOutTxTracker
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupOutTxTracker
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthOutTxTracker
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthOutTxTracker = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowOutTxTracker = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupOutTxTracker = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"gopkg.in/yaml.v2"
)
var _ paramtypes.ParamSet = (*Params)(nil)
// ParamKeyTable the param key table for launch module
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}
// NewParams creates a new Params instance
func NewParams() Params {
return Params{
Enabled: true,
}
}
// DefaultParams returns a default set of parameters
func DefaultParams() Params {
return NewParams()
}
// ParamSetPairs get the params.ParamSet
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{}
}
// Validate validates the set of params
func (p Params) Validate() error {
return nil
}
// String implements the Stringer interface.
func (p Params) String() string {
out, err := yaml.Marshal(p)
if err != nil {
return ""
}
return string(out)
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/params.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the parameters for the module.
type Params struct {
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
}
func (m *Params) Reset() { *m = Params{} }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_cd6915e32c251e53, []int{0}
}
func (m *Params) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Params) XXX_Merge(src proto.Message) {
xxx_messageInfo_Params.Merge(m, src)
}
func (m *Params) XXX_Size() int {
return m.Size()
}
func (m *Params) XXX_DiscardUnknown() {
xxx_messageInfo_Params.DiscardUnknown(m)
}
var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetEnabled() bool {
if m != nil {
return m.Enabled
}
return false
}
func init() {
proto.RegisterType((*Params)(nil), "zetachain.zetacore.crosschain.Params")
}
func init() { proto.RegisterFile("crosschain/params.proto", fileDescriptor_cd6915e32c251e53) }
var fileDescriptor_cd6915e32c251e53 = []byte{
// 175 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0x2e, 0xca, 0x2f,
0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28,
0xca, 0x2f, 0xc9, 0x17, 0x92, 0xad, 0x4a, 0x2d, 0x49, 0x04, 0x8b, 0xeb, 0x81, 0x59, 0xf9, 0x45,
0xa9, 0x7a, 0x08, 0xb5, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x95, 0xfa, 0x20, 0x16, 0x44,
0x93, 0x92, 0x06, 0x17, 0x5b, 0x00, 0xd8, 0x10, 0x21, 0x09, 0x2e, 0xf6, 0xd4, 0xbc, 0xc4, 0xa4,
0x9c, 0xd4, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x8e, 0x20, 0x18, 0xd7, 0x8a, 0x65, 0xc6, 0x02,
0x79, 0x06, 0x27, 0xef, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e,
0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c,
0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0xd9, 0xac, 0x0b, 0x71, 0x1c,
0xcc, 0x11, 0xfa, 0x15, 0xfa, 0x48, 0x4e, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xdb,
0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x96, 0x4e, 0x4b, 0x16, 0xcd, 0x00, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Enabled {
i--
if m.Enabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintParams(dAtA []byte, offset int, v uint64) int {
offset -= sovParams(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Params) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Enabled {
n += 2
}
return n
}
func sovParams(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozParams(x uint64) (n int) {
return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Params) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Params: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Enabled = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipParams(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthParams
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupParams
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthParams
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowParams = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/query.proto
package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type QueryTssHistoryRequest struct {
}
func (m *QueryTssHistoryRequest) Reset() { *m = QueryTssHistoryRequest{} }
func (m *QueryTssHistoryRequest) String() string { return proto.CompactTextString(m) }
func (*QueryTssHistoryRequest) ProtoMessage() {}
func (*QueryTssHistoryRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{0}
}
func (m *QueryTssHistoryRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTssHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTssHistoryRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTssHistoryRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTssHistoryRequest.Merge(m, src)
}
func (m *QueryTssHistoryRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryTssHistoryRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTssHistoryRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTssHistoryRequest proto.InternalMessageInfo
type QueryTssHistoryResponse struct {
TssList []TSS `protobuf:"bytes,1,rep,name=tss_list,json=tssList,proto3" json:"tss_list"`
}
func (m *QueryTssHistoryResponse) Reset() { *m = QueryTssHistoryResponse{} }
func (m *QueryTssHistoryResponse) String() string { return proto.CompactTextString(m) }
func (*QueryTssHistoryResponse) ProtoMessage() {}
func (*QueryTssHistoryResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{1}
}
func (m *QueryTssHistoryResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTssHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTssHistoryResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTssHistoryResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTssHistoryResponse.Merge(m, src)
}
func (m *QueryTssHistoryResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryTssHistoryResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTssHistoryResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTssHistoryResponse proto.InternalMessageInfo
func (m *QueryTssHistoryResponse) GetTssList() []TSS {
if m != nil {
return m.TssList
}
return nil
}
// QueryParamsRequest is request type for the Query/Params RPC method.
type QueryParamsRequest struct {
}
func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{2}
}
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsRequest.Merge(m, src)
}
func (m *QueryParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo
// QueryParamsResponse is response type for the Query/Params RPC method.
type QueryParamsResponse struct {
// params holds all the parameters of this module.
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{3}
}
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsResponse.Merge(m, src)
}
func (m *QueryParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo
func (m *QueryParamsResponse) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
type QueryGetOutTxTrackerRequest struct {
ChainID int64 `protobuf:"varint,1,opt,name=chainID,proto3" json:"chainID,omitempty"`
Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
}
func (m *QueryGetOutTxTrackerRequest) Reset() { *m = QueryGetOutTxTrackerRequest{} }
func (m *QueryGetOutTxTrackerRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetOutTxTrackerRequest) ProtoMessage() {}
func (*QueryGetOutTxTrackerRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{4}
}
func (m *QueryGetOutTxTrackerRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetOutTxTrackerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetOutTxTrackerRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetOutTxTrackerRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetOutTxTrackerRequest.Merge(m, src)
}
func (m *QueryGetOutTxTrackerRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetOutTxTrackerRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetOutTxTrackerRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetOutTxTrackerRequest proto.InternalMessageInfo
func (m *QueryGetOutTxTrackerRequest) GetChainID() int64 {
if m != nil {
return m.ChainID
}
return 0
}
func (m *QueryGetOutTxTrackerRequest) GetNonce() uint64 {
if m != nil {
return m.Nonce
}
return 0
}
type QueryGetOutTxTrackerResponse struct {
OutTxTracker OutTxTracker `protobuf:"bytes,1,opt,name=outTxTracker,proto3" json:"outTxTracker"`
}
func (m *QueryGetOutTxTrackerResponse) Reset() { *m = QueryGetOutTxTrackerResponse{} }
func (m *QueryGetOutTxTrackerResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetOutTxTrackerResponse) ProtoMessage() {}
func (*QueryGetOutTxTrackerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{5}
}
func (m *QueryGetOutTxTrackerResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetOutTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetOutTxTrackerResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetOutTxTrackerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetOutTxTrackerResponse.Merge(m, src)
}
func (m *QueryGetOutTxTrackerResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetOutTxTrackerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetOutTxTrackerResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetOutTxTrackerResponse proto.InternalMessageInfo
func (m *QueryGetOutTxTrackerResponse) GetOutTxTracker() OutTxTracker {
if m != nil {
return m.OutTxTracker
}
return OutTxTracker{}
}
type QueryAllOutTxTrackerRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllOutTxTrackerRequest) Reset() { *m = QueryAllOutTxTrackerRequest{} }
func (m *QueryAllOutTxTrackerRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllOutTxTrackerRequest) ProtoMessage() {}
func (*QueryAllOutTxTrackerRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{6}
}
func (m *QueryAllOutTxTrackerRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllOutTxTrackerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllOutTxTrackerRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllOutTxTrackerRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllOutTxTrackerRequest.Merge(m, src)
}
func (m *QueryAllOutTxTrackerRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllOutTxTrackerRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllOutTxTrackerRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllOutTxTrackerRequest proto.InternalMessageInfo
func (m *QueryAllOutTxTrackerRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllOutTxTrackerResponse struct {
OutTxTracker []OutTxTracker `protobuf:"bytes,1,rep,name=outTxTracker,proto3" json:"outTxTracker"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllOutTxTrackerResponse) Reset() { *m = QueryAllOutTxTrackerResponse{} }
func (m *QueryAllOutTxTrackerResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllOutTxTrackerResponse) ProtoMessage() {}
func (*QueryAllOutTxTrackerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{7}
}
func (m *QueryAllOutTxTrackerResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllOutTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllOutTxTrackerResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllOutTxTrackerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllOutTxTrackerResponse.Merge(m, src)
}
func (m *QueryAllOutTxTrackerResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllOutTxTrackerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllOutTxTrackerResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllOutTxTrackerResponse proto.InternalMessageInfo
func (m *QueryAllOutTxTrackerResponse) GetOutTxTracker() []OutTxTracker {
if m != nil {
return m.OutTxTracker
}
return nil
}
func (m *QueryAllOutTxTrackerResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllOutTxTrackerByChainRequest struct {
Chain int64 `protobuf:"varint,1,opt,name=chain,proto3" json:"chain,omitempty"`
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllOutTxTrackerByChainRequest) Reset() { *m = QueryAllOutTxTrackerByChainRequest{} }
func (m *QueryAllOutTxTrackerByChainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllOutTxTrackerByChainRequest) ProtoMessage() {}
func (*QueryAllOutTxTrackerByChainRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{8}
}
func (m *QueryAllOutTxTrackerByChainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllOutTxTrackerByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllOutTxTrackerByChainRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllOutTxTrackerByChainRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllOutTxTrackerByChainRequest.Merge(m, src)
}
func (m *QueryAllOutTxTrackerByChainRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllOutTxTrackerByChainRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllOutTxTrackerByChainRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllOutTxTrackerByChainRequest proto.InternalMessageInfo
func (m *QueryAllOutTxTrackerByChainRequest) GetChain() int64 {
if m != nil {
return m.Chain
}
return 0
}
func (m *QueryAllOutTxTrackerByChainRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllOutTxTrackerByChainResponse struct {
OutTxTracker []OutTxTracker `protobuf:"bytes,1,rep,name=outTxTracker,proto3" json:"outTxTracker"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllOutTxTrackerByChainResponse) Reset() { *m = QueryAllOutTxTrackerByChainResponse{} }
func (m *QueryAllOutTxTrackerByChainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllOutTxTrackerByChainResponse) ProtoMessage() {}
func (*QueryAllOutTxTrackerByChainResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{9}
}
func (m *QueryAllOutTxTrackerByChainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllOutTxTrackerByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllOutTxTrackerByChainResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllOutTxTrackerByChainResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllOutTxTrackerByChainResponse.Merge(m, src)
}
func (m *QueryAllOutTxTrackerByChainResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllOutTxTrackerByChainResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllOutTxTrackerByChainResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllOutTxTrackerByChainResponse proto.InternalMessageInfo
func (m *QueryAllOutTxTrackerByChainResponse) GetOutTxTracker() []OutTxTracker {
if m != nil {
return m.OutTxTracker
}
return nil
}
func (m *QueryAllOutTxTrackerByChainResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllInTxTrackerByChainRequest struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllInTxTrackerByChainRequest) Reset() { *m = QueryAllInTxTrackerByChainRequest{} }
func (m *QueryAllInTxTrackerByChainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllInTxTrackerByChainRequest) ProtoMessage() {}
func (*QueryAllInTxTrackerByChainRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{10}
}
func (m *QueryAllInTxTrackerByChainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllInTxTrackerByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllInTxTrackerByChainRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllInTxTrackerByChainRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllInTxTrackerByChainRequest.Merge(m, src)
}
func (m *QueryAllInTxTrackerByChainRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllInTxTrackerByChainRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllInTxTrackerByChainRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllInTxTrackerByChainRequest proto.InternalMessageInfo
func (m *QueryAllInTxTrackerByChainRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *QueryAllInTxTrackerByChainRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllInTxTrackerByChainResponse struct {
InTxTracker []InTxTracker `protobuf:"bytes,1,rep,name=inTxTracker,proto3" json:"inTxTracker"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllInTxTrackerByChainResponse) Reset() { *m = QueryAllInTxTrackerByChainResponse{} }
func (m *QueryAllInTxTrackerByChainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllInTxTrackerByChainResponse) ProtoMessage() {}
func (*QueryAllInTxTrackerByChainResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{11}
}
func (m *QueryAllInTxTrackerByChainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllInTxTrackerByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllInTxTrackerByChainResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllInTxTrackerByChainResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllInTxTrackerByChainResponse.Merge(m, src)
}
func (m *QueryAllInTxTrackerByChainResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllInTxTrackerByChainResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllInTxTrackerByChainResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllInTxTrackerByChainResponse proto.InternalMessageInfo
func (m *QueryAllInTxTrackerByChainResponse) GetInTxTracker() []InTxTracker {
if m != nil {
return m.InTxTracker
}
return nil
}
func (m *QueryAllInTxTrackerByChainResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllInTxTrackersRequest struct {
}
func (m *QueryAllInTxTrackersRequest) Reset() { *m = QueryAllInTxTrackersRequest{} }
func (m *QueryAllInTxTrackersRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllInTxTrackersRequest) ProtoMessage() {}
func (*QueryAllInTxTrackersRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{12}
}
func (m *QueryAllInTxTrackersRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllInTxTrackersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllInTxTrackersRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllInTxTrackersRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllInTxTrackersRequest.Merge(m, src)
}
func (m *QueryAllInTxTrackersRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllInTxTrackersRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllInTxTrackersRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllInTxTrackersRequest proto.InternalMessageInfo
type QueryAllInTxTrackersResponse struct {
InTxTracker []InTxTracker `protobuf:"bytes,1,rep,name=inTxTracker,proto3" json:"inTxTracker"`
}
func (m *QueryAllInTxTrackersResponse) Reset() { *m = QueryAllInTxTrackersResponse{} }
func (m *QueryAllInTxTrackersResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllInTxTrackersResponse) ProtoMessage() {}
func (*QueryAllInTxTrackersResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{13}
}
func (m *QueryAllInTxTrackersResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllInTxTrackersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllInTxTrackersResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllInTxTrackersResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllInTxTrackersResponse.Merge(m, src)
}
func (m *QueryAllInTxTrackersResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllInTxTrackersResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllInTxTrackersResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllInTxTrackersResponse proto.InternalMessageInfo
func (m *QueryAllInTxTrackersResponse) GetInTxTracker() []InTxTracker {
if m != nil {
return m.InTxTracker
}
return nil
}
type QueryGetInTxHashToCctxRequest struct {
InTxHash string `protobuf:"bytes,1,opt,name=inTxHash,proto3" json:"inTxHash,omitempty"`
}
func (m *QueryGetInTxHashToCctxRequest) Reset() { *m = QueryGetInTxHashToCctxRequest{} }
func (m *QueryGetInTxHashToCctxRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetInTxHashToCctxRequest) ProtoMessage() {}
func (*QueryGetInTxHashToCctxRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{14}
}
func (m *QueryGetInTxHashToCctxRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetInTxHashToCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetInTxHashToCctxRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetInTxHashToCctxRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetInTxHashToCctxRequest.Merge(m, src)
}
func (m *QueryGetInTxHashToCctxRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetInTxHashToCctxRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetInTxHashToCctxRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetInTxHashToCctxRequest proto.InternalMessageInfo
func (m *QueryGetInTxHashToCctxRequest) GetInTxHash() string {
if m != nil {
return m.InTxHash
}
return ""
}
type QueryGetInTxHashToCctxResponse struct {
InTxHashToCctx InTxHashToCctx `protobuf:"bytes,1,opt,name=inTxHashToCctx,proto3" json:"inTxHashToCctx"`
}
func (m *QueryGetInTxHashToCctxResponse) Reset() { *m = QueryGetInTxHashToCctxResponse{} }
func (m *QueryGetInTxHashToCctxResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetInTxHashToCctxResponse) ProtoMessage() {}
func (*QueryGetInTxHashToCctxResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{15}
}
func (m *QueryGetInTxHashToCctxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetInTxHashToCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetInTxHashToCctxResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetInTxHashToCctxResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetInTxHashToCctxResponse.Merge(m, src)
}
func (m *QueryGetInTxHashToCctxResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetInTxHashToCctxResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetInTxHashToCctxResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetInTxHashToCctxResponse proto.InternalMessageInfo
func (m *QueryGetInTxHashToCctxResponse) GetInTxHashToCctx() InTxHashToCctx {
if m != nil {
return m.InTxHashToCctx
}
return InTxHashToCctx{}
}
type QueryInTxHashToCctxDataRequest struct {
InTxHash string `protobuf:"bytes,1,opt,name=inTxHash,proto3" json:"inTxHash,omitempty"`
}
func (m *QueryInTxHashToCctxDataRequest) Reset() { *m = QueryInTxHashToCctxDataRequest{} }
func (m *QueryInTxHashToCctxDataRequest) String() string { return proto.CompactTextString(m) }
func (*QueryInTxHashToCctxDataRequest) ProtoMessage() {}
func (*QueryInTxHashToCctxDataRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{16}
}
func (m *QueryInTxHashToCctxDataRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryInTxHashToCctxDataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryInTxHashToCctxDataRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryInTxHashToCctxDataRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryInTxHashToCctxDataRequest.Merge(m, src)
}
func (m *QueryInTxHashToCctxDataRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryInTxHashToCctxDataRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryInTxHashToCctxDataRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryInTxHashToCctxDataRequest proto.InternalMessageInfo
func (m *QueryInTxHashToCctxDataRequest) GetInTxHash() string {
if m != nil {
return m.InTxHash
}
return ""
}
type QueryInTxHashToCctxDataResponse struct {
CrossChainTxs []CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTxs,proto3" json:"CrossChainTxs"`
}
func (m *QueryInTxHashToCctxDataResponse) Reset() { *m = QueryInTxHashToCctxDataResponse{} }
func (m *QueryInTxHashToCctxDataResponse) String() string { return proto.CompactTextString(m) }
func (*QueryInTxHashToCctxDataResponse) ProtoMessage() {}
func (*QueryInTxHashToCctxDataResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{17}
}
func (m *QueryInTxHashToCctxDataResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryInTxHashToCctxDataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryInTxHashToCctxDataResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryInTxHashToCctxDataResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryInTxHashToCctxDataResponse.Merge(m, src)
}
func (m *QueryInTxHashToCctxDataResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryInTxHashToCctxDataResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryInTxHashToCctxDataResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryInTxHashToCctxDataResponse proto.InternalMessageInfo
func (m *QueryInTxHashToCctxDataResponse) GetCrossChainTxs() []CrossChainTx {
if m != nil {
return m.CrossChainTxs
}
return nil
}
type QueryAllInTxHashToCctxRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllInTxHashToCctxRequest) Reset() { *m = QueryAllInTxHashToCctxRequest{} }
func (m *QueryAllInTxHashToCctxRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllInTxHashToCctxRequest) ProtoMessage() {}
func (*QueryAllInTxHashToCctxRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{18}
}
func (m *QueryAllInTxHashToCctxRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllInTxHashToCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllInTxHashToCctxRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllInTxHashToCctxRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllInTxHashToCctxRequest.Merge(m, src)
}
func (m *QueryAllInTxHashToCctxRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllInTxHashToCctxRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllInTxHashToCctxRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllInTxHashToCctxRequest proto.InternalMessageInfo
func (m *QueryAllInTxHashToCctxRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllInTxHashToCctxResponse struct {
InTxHashToCctx []InTxHashToCctx `protobuf:"bytes,1,rep,name=inTxHashToCctx,proto3" json:"inTxHashToCctx"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllInTxHashToCctxResponse) Reset() { *m = QueryAllInTxHashToCctxResponse{} }
func (m *QueryAllInTxHashToCctxResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllInTxHashToCctxResponse) ProtoMessage() {}
func (*QueryAllInTxHashToCctxResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{19}
}
func (m *QueryAllInTxHashToCctxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllInTxHashToCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllInTxHashToCctxResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllInTxHashToCctxResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllInTxHashToCctxResponse.Merge(m, src)
}
func (m *QueryAllInTxHashToCctxResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllInTxHashToCctxResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllInTxHashToCctxResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllInTxHashToCctxResponse proto.InternalMessageInfo
func (m *QueryAllInTxHashToCctxResponse) GetInTxHashToCctx() []InTxHashToCctx {
if m != nil {
return m.InTxHashToCctx
}
return nil
}
func (m *QueryAllInTxHashToCctxResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryGetTssAddressRequest struct {
TssPubKey string `protobuf:"bytes,1,opt,name=tss_pub_key,json=tssPubKey,proto3" json:"tss_pub_key,omitempty"`
}
func (m *QueryGetTssAddressRequest) Reset() { *m = QueryGetTssAddressRequest{} }
func (m *QueryGetTssAddressRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetTssAddressRequest) ProtoMessage() {}
func (*QueryGetTssAddressRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{20}
}
func (m *QueryGetTssAddressRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetTssAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetTssAddressRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetTssAddressRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetTssAddressRequest.Merge(m, src)
}
func (m *QueryGetTssAddressRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetTssAddressRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetTssAddressRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetTssAddressRequest proto.InternalMessageInfo
func (m *QueryGetTssAddressRequest) GetTssPubKey() string {
if m != nil {
return m.TssPubKey
}
return ""
}
type QueryGetTssAddressResponse struct {
Eth string `protobuf:"bytes,1,opt,name=eth,proto3" json:"eth,omitempty"`
Btc string `protobuf:"bytes,2,opt,name=btc,proto3" json:"btc,omitempty"`
}
func (m *QueryGetTssAddressResponse) Reset() { *m = QueryGetTssAddressResponse{} }
func (m *QueryGetTssAddressResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetTssAddressResponse) ProtoMessage() {}
func (*QueryGetTssAddressResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{21}
}
func (m *QueryGetTssAddressResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetTssAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetTssAddressResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetTssAddressResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetTssAddressResponse.Merge(m, src)
}
func (m *QueryGetTssAddressResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetTssAddressResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetTssAddressResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetTssAddressResponse proto.InternalMessageInfo
func (m *QueryGetTssAddressResponse) GetEth() string {
if m != nil {
return m.Eth
}
return ""
}
func (m *QueryGetTssAddressResponse) GetBtc() string {
if m != nil {
return m.Btc
}
return ""
}
type QueryGetTSSRequest struct {
}
func (m *QueryGetTSSRequest) Reset() { *m = QueryGetTSSRequest{} }
func (m *QueryGetTSSRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetTSSRequest) ProtoMessage() {}
func (*QueryGetTSSRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{22}
}
func (m *QueryGetTSSRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetTSSRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetTSSRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetTSSRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetTSSRequest.Merge(m, src)
}
func (m *QueryGetTSSRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetTSSRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetTSSRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetTSSRequest proto.InternalMessageInfo
type QueryGetTSSResponse struct {
TSS *TSS `protobuf:"bytes,1,opt,name=TSS,proto3" json:"TSS,omitempty"`
}
func (m *QueryGetTSSResponse) Reset() { *m = QueryGetTSSResponse{} }
func (m *QueryGetTSSResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetTSSResponse) ProtoMessage() {}
func (*QueryGetTSSResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{23}
}
func (m *QueryGetTSSResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetTSSResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetTSSResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetTSSResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetTSSResponse.Merge(m, src)
}
func (m *QueryGetTSSResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetTSSResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetTSSResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetTSSResponse proto.InternalMessageInfo
func (m *QueryGetTSSResponse) GetTSS() *TSS {
if m != nil {
return m.TSS
}
return nil
}
type QueryGetGasPriceRequest struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *QueryGetGasPriceRequest) Reset() { *m = QueryGetGasPriceRequest{} }
func (m *QueryGetGasPriceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetGasPriceRequest) ProtoMessage() {}
func (*QueryGetGasPriceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{24}
}
func (m *QueryGetGasPriceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetGasPriceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetGasPriceRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetGasPriceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetGasPriceRequest.Merge(m, src)
}
func (m *QueryGetGasPriceRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetGasPriceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetGasPriceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetGasPriceRequest proto.InternalMessageInfo
func (m *QueryGetGasPriceRequest) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
type QueryGetGasPriceResponse struct {
GasPrice *GasPrice `protobuf:"bytes,1,opt,name=GasPrice,proto3" json:"GasPrice,omitempty"`
}
func (m *QueryGetGasPriceResponse) Reset() { *m = QueryGetGasPriceResponse{} }
func (m *QueryGetGasPriceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetGasPriceResponse) ProtoMessage() {}
func (*QueryGetGasPriceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{25}
}
func (m *QueryGetGasPriceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetGasPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetGasPriceResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetGasPriceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetGasPriceResponse.Merge(m, src)
}
func (m *QueryGetGasPriceResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetGasPriceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetGasPriceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetGasPriceResponse proto.InternalMessageInfo
func (m *QueryGetGasPriceResponse) GetGasPrice() *GasPrice {
if m != nil {
return m.GasPrice
}
return nil
}
type QueryAllGasPriceRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllGasPriceRequest) Reset() { *m = QueryAllGasPriceRequest{} }
func (m *QueryAllGasPriceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllGasPriceRequest) ProtoMessage() {}
func (*QueryAllGasPriceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{26}
}
func (m *QueryAllGasPriceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllGasPriceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllGasPriceRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllGasPriceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllGasPriceRequest.Merge(m, src)
}
func (m *QueryAllGasPriceRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllGasPriceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllGasPriceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllGasPriceRequest proto.InternalMessageInfo
func (m *QueryAllGasPriceRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllGasPriceResponse struct {
GasPrice []*GasPrice `protobuf:"bytes,1,rep,name=GasPrice,proto3" json:"GasPrice,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllGasPriceResponse) Reset() { *m = QueryAllGasPriceResponse{} }
func (m *QueryAllGasPriceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllGasPriceResponse) ProtoMessage() {}
func (*QueryAllGasPriceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{27}
}
func (m *QueryAllGasPriceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllGasPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllGasPriceResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllGasPriceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllGasPriceResponse.Merge(m, src)
}
func (m *QueryAllGasPriceResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllGasPriceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllGasPriceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllGasPriceResponse proto.InternalMessageInfo
func (m *QueryAllGasPriceResponse) GetGasPrice() []*GasPrice {
if m != nil {
return m.GasPrice
}
return nil
}
func (m *QueryAllGasPriceResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryGetChainNoncesRequest struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *QueryGetChainNoncesRequest) Reset() { *m = QueryGetChainNoncesRequest{} }
func (m *QueryGetChainNoncesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetChainNoncesRequest) ProtoMessage() {}
func (*QueryGetChainNoncesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{28}
}
func (m *QueryGetChainNoncesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetChainNoncesRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetChainNoncesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetChainNoncesRequest.Merge(m, src)
}
func (m *QueryGetChainNoncesRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetChainNoncesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetChainNoncesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetChainNoncesRequest proto.InternalMessageInfo
func (m *QueryGetChainNoncesRequest) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
type QueryGetChainNoncesResponse struct {
ChainNonces *ChainNonces `protobuf:"bytes,1,opt,name=ChainNonces,proto3" json:"ChainNonces,omitempty"`
}
func (m *QueryGetChainNoncesResponse) Reset() { *m = QueryGetChainNoncesResponse{} }
func (m *QueryGetChainNoncesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetChainNoncesResponse) ProtoMessage() {}
func (*QueryGetChainNoncesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{29}
}
func (m *QueryGetChainNoncesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetChainNoncesResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetChainNoncesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetChainNoncesResponse.Merge(m, src)
}
func (m *QueryGetChainNoncesResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetChainNoncesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetChainNoncesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetChainNoncesResponse proto.InternalMessageInfo
func (m *QueryGetChainNoncesResponse) GetChainNonces() *ChainNonces {
if m != nil {
return m.ChainNonces
}
return nil
}
type QueryAllChainNoncesRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllChainNoncesRequest) Reset() { *m = QueryAllChainNoncesRequest{} }
func (m *QueryAllChainNoncesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllChainNoncesRequest) ProtoMessage() {}
func (*QueryAllChainNoncesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{30}
}
func (m *QueryAllChainNoncesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllChainNoncesRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllChainNoncesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllChainNoncesRequest.Merge(m, src)
}
func (m *QueryAllChainNoncesRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllChainNoncesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllChainNoncesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllChainNoncesRequest proto.InternalMessageInfo
func (m *QueryAllChainNoncesRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllChainNoncesResponse struct {
ChainNonces []*ChainNonces `protobuf:"bytes,1,rep,name=ChainNonces,proto3" json:"ChainNonces,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllChainNoncesResponse) Reset() { *m = QueryAllChainNoncesResponse{} }
func (m *QueryAllChainNoncesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllChainNoncesResponse) ProtoMessage() {}
func (*QueryAllChainNoncesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{31}
}
func (m *QueryAllChainNoncesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllChainNoncesResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllChainNoncesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllChainNoncesResponse.Merge(m, src)
}
func (m *QueryAllChainNoncesResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllChainNoncesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllChainNoncesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllChainNoncesResponse proto.InternalMessageInfo
func (m *QueryAllChainNoncesResponse) GetChainNonces() []*ChainNonces {
if m != nil {
return m.ChainNonces
}
return nil
}
func (m *QueryAllChainNoncesResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllPendingNoncesRequest struct {
}
func (m *QueryAllPendingNoncesRequest) Reset() { *m = QueryAllPendingNoncesRequest{} }
func (m *QueryAllPendingNoncesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllPendingNoncesRequest) ProtoMessage() {}
func (*QueryAllPendingNoncesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{32}
}
func (m *QueryAllPendingNoncesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllPendingNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllPendingNoncesRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllPendingNoncesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllPendingNoncesRequest.Merge(m, src)
}
func (m *QueryAllPendingNoncesRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllPendingNoncesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllPendingNoncesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllPendingNoncesRequest proto.InternalMessageInfo
type QueryAllPendingNoncesResponse struct {
PendingNonces []*PendingNonces `protobuf:"bytes,1,rep,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces,omitempty"`
}
func (m *QueryAllPendingNoncesResponse) Reset() { *m = QueryAllPendingNoncesResponse{} }
func (m *QueryAllPendingNoncesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllPendingNoncesResponse) ProtoMessage() {}
func (*QueryAllPendingNoncesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{33}
}
func (m *QueryAllPendingNoncesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllPendingNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllPendingNoncesResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllPendingNoncesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllPendingNoncesResponse.Merge(m, src)
}
func (m *QueryAllPendingNoncesResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllPendingNoncesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllPendingNoncesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllPendingNoncesResponse proto.InternalMessageInfo
func (m *QueryAllPendingNoncesResponse) GetPendingNonces() []*PendingNonces {
if m != nil {
return m.PendingNonces
}
return nil
}
type QueryPendingNoncesByChainRequest struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *QueryPendingNoncesByChainRequest) Reset() { *m = QueryPendingNoncesByChainRequest{} }
func (m *QueryPendingNoncesByChainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryPendingNoncesByChainRequest) ProtoMessage() {}
func (*QueryPendingNoncesByChainRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{34}
}
func (m *QueryPendingNoncesByChainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryPendingNoncesByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryPendingNoncesByChainRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryPendingNoncesByChainRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryPendingNoncesByChainRequest.Merge(m, src)
}
func (m *QueryPendingNoncesByChainRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryPendingNoncesByChainRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryPendingNoncesByChainRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryPendingNoncesByChainRequest proto.InternalMessageInfo
func (m *QueryPendingNoncesByChainRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
type QueryPendingNoncesByChainResponse struct {
PendingNonces PendingNonces `protobuf:"bytes,1,opt,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces"`
}
func (m *QueryPendingNoncesByChainResponse) Reset() { *m = QueryPendingNoncesByChainResponse{} }
func (m *QueryPendingNoncesByChainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryPendingNoncesByChainResponse) ProtoMessage() {}
func (*QueryPendingNoncesByChainResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{35}
}
func (m *QueryPendingNoncesByChainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryPendingNoncesByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryPendingNoncesByChainResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryPendingNoncesByChainResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryPendingNoncesByChainResponse.Merge(m, src)
}
func (m *QueryPendingNoncesByChainResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryPendingNoncesByChainResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryPendingNoncesByChainResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryPendingNoncesByChainResponse proto.InternalMessageInfo
func (m *QueryPendingNoncesByChainResponse) GetPendingNonces() PendingNonces {
if m != nil {
return m.PendingNonces
}
return PendingNonces{}
}
type QueryGetLastBlockHeightRequest struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *QueryGetLastBlockHeightRequest) Reset() { *m = QueryGetLastBlockHeightRequest{} }
func (m *QueryGetLastBlockHeightRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetLastBlockHeightRequest) ProtoMessage() {}
func (*QueryGetLastBlockHeightRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{36}
}
func (m *QueryGetLastBlockHeightRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetLastBlockHeightRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetLastBlockHeightRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetLastBlockHeightRequest.Merge(m, src)
}
func (m *QueryGetLastBlockHeightRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetLastBlockHeightRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetLastBlockHeightRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetLastBlockHeightRequest proto.InternalMessageInfo
func (m *QueryGetLastBlockHeightRequest) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
type QueryGetLastBlockHeightResponse struct {
LastBlockHeight *LastBlockHeight `protobuf:"bytes,1,opt,name=LastBlockHeight,proto3" json:"LastBlockHeight,omitempty"`
}
func (m *QueryGetLastBlockHeightResponse) Reset() { *m = QueryGetLastBlockHeightResponse{} }
func (m *QueryGetLastBlockHeightResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetLastBlockHeightResponse) ProtoMessage() {}
func (*QueryGetLastBlockHeightResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{37}
}
func (m *QueryGetLastBlockHeightResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetLastBlockHeightResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetLastBlockHeightResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetLastBlockHeightResponse.Merge(m, src)
}
func (m *QueryGetLastBlockHeightResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetLastBlockHeightResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetLastBlockHeightResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetLastBlockHeightResponse proto.InternalMessageInfo
func (m *QueryGetLastBlockHeightResponse) GetLastBlockHeight() *LastBlockHeight {
if m != nil {
return m.LastBlockHeight
}
return nil
}
type QueryAllLastBlockHeightRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllLastBlockHeightRequest) Reset() { *m = QueryAllLastBlockHeightRequest{} }
func (m *QueryAllLastBlockHeightRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllLastBlockHeightRequest) ProtoMessage() {}
func (*QueryAllLastBlockHeightRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{38}
}
func (m *QueryAllLastBlockHeightRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllLastBlockHeightRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllLastBlockHeightRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllLastBlockHeightRequest.Merge(m, src)
}
func (m *QueryAllLastBlockHeightRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllLastBlockHeightRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllLastBlockHeightRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllLastBlockHeightRequest proto.InternalMessageInfo
func (m *QueryAllLastBlockHeightRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllLastBlockHeightResponse struct {
LastBlockHeight []*LastBlockHeight `protobuf:"bytes,1,rep,name=LastBlockHeight,proto3" json:"LastBlockHeight,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllLastBlockHeightResponse) Reset() { *m = QueryAllLastBlockHeightResponse{} }
func (m *QueryAllLastBlockHeightResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllLastBlockHeightResponse) ProtoMessage() {}
func (*QueryAllLastBlockHeightResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{39}
}
func (m *QueryAllLastBlockHeightResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllLastBlockHeightResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllLastBlockHeightResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllLastBlockHeightResponse.Merge(m, src)
}
func (m *QueryAllLastBlockHeightResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllLastBlockHeightResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllLastBlockHeightResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllLastBlockHeightResponse proto.InternalMessageInfo
func (m *QueryAllLastBlockHeightResponse) GetLastBlockHeight() []*LastBlockHeight {
if m != nil {
return m.LastBlockHeight
}
return nil
}
func (m *QueryAllLastBlockHeightResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryGetCctxRequest struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *QueryGetCctxRequest) Reset() { *m = QueryGetCctxRequest{} }
func (m *QueryGetCctxRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCctxRequest) ProtoMessage() {}
func (*QueryGetCctxRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{40}
}
func (m *QueryGetCctxRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCctxRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCctxRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCctxRequest.Merge(m, src)
}
func (m *QueryGetCctxRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCctxRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCctxRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCctxRequest proto.InternalMessageInfo
func (m *QueryGetCctxRequest) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
type QueryGetCctxByNonceRequest struct {
ChainID int64 `protobuf:"varint,1,opt,name=chainID,proto3" json:"chainID,omitempty"`
Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
}
func (m *QueryGetCctxByNonceRequest) Reset() { *m = QueryGetCctxByNonceRequest{} }
func (m *QueryGetCctxByNonceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCctxByNonceRequest) ProtoMessage() {}
func (*QueryGetCctxByNonceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{41}
}
func (m *QueryGetCctxByNonceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCctxByNonceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCctxByNonceRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCctxByNonceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCctxByNonceRequest.Merge(m, src)
}
func (m *QueryGetCctxByNonceRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCctxByNonceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCctxByNonceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCctxByNonceRequest proto.InternalMessageInfo
func (m *QueryGetCctxByNonceRequest) GetChainID() int64 {
if m != nil {
return m.ChainID
}
return 0
}
func (m *QueryGetCctxByNonceRequest) GetNonce() uint64 {
if m != nil {
return m.Nonce
}
return 0
}
type QueryGetCctxResponse struct {
CrossChainTx *CrossChainTx `protobuf:"bytes,1,opt,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"`
}
func (m *QueryGetCctxResponse) Reset() { *m = QueryGetCctxResponse{} }
func (m *QueryGetCctxResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetCctxResponse) ProtoMessage() {}
func (*QueryGetCctxResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{42}
}
func (m *QueryGetCctxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCctxResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCctxResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCctxResponse.Merge(m, src)
}
func (m *QueryGetCctxResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCctxResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCctxResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCctxResponse proto.InternalMessageInfo
func (m *QueryGetCctxResponse) GetCrossChainTx() *CrossChainTx {
if m != nil {
return m.CrossChainTx
}
return nil
}
type QueryAllCctxRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllCctxRequest) Reset() { *m = QueryAllCctxRequest{} }
func (m *QueryAllCctxRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxRequest) ProtoMessage() {}
func (*QueryAllCctxRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{43}
}
func (m *QueryAllCctxRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllCctxRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllCctxRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllCctxRequest.Merge(m, src)
}
func (m *QueryAllCctxRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllCctxRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllCctxRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllCctxRequest proto.InternalMessageInfo
func (m *QueryAllCctxRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllCctxResponse struct {
CrossChainTx []*CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllCctxResponse) Reset() { *m = QueryAllCctxResponse{} }
func (m *QueryAllCctxResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxResponse) ProtoMessage() {}
func (*QueryAllCctxResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{44}
}
func (m *QueryAllCctxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllCctxResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllCctxResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllCctxResponse.Merge(m, src)
}
func (m *QueryAllCctxResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllCctxResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllCctxResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllCctxResponse proto.InternalMessageInfo
func (m *QueryAllCctxResponse) GetCrossChainTx() []*CrossChainTx {
if m != nil {
return m.CrossChainTx
}
return nil
}
func (m *QueryAllCctxResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllCctxPendingRequest struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllCctxPendingRequest) Reset() { *m = QueryAllCctxPendingRequest{} }
func (m *QueryAllCctxPendingRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxPendingRequest) ProtoMessage() {}
func (*QueryAllCctxPendingRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{45}
}
func (m *QueryAllCctxPendingRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllCctxPendingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllCctxPendingRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllCctxPendingRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllCctxPendingRequest.Merge(m, src)
}
func (m *QueryAllCctxPendingRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllCctxPendingRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllCctxPendingRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllCctxPendingRequest proto.InternalMessageInfo
func (m *QueryAllCctxPendingRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *QueryAllCctxPendingRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllCctxPendingResponse struct {
CrossChainTx []*CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllCctxPendingResponse) Reset() { *m = QueryAllCctxPendingResponse{} }
func (m *QueryAllCctxPendingResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxPendingResponse) ProtoMessage() {}
func (*QueryAllCctxPendingResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{46}
}
func (m *QueryAllCctxPendingResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllCctxPendingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllCctxPendingResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllCctxPendingResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllCctxPendingResponse.Merge(m, src)
}
func (m *QueryAllCctxPendingResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllCctxPendingResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllCctxPendingResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllCctxPendingResponse proto.InternalMessageInfo
func (m *QueryAllCctxPendingResponse) GetCrossChainTx() []*CrossChainTx {
if m != nil {
return m.CrossChainTx
}
return nil
}
func (m *QueryAllCctxPendingResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryLastZetaHeightRequest struct {
}
func (m *QueryLastZetaHeightRequest) Reset() { *m = QueryLastZetaHeightRequest{} }
func (m *QueryLastZetaHeightRequest) String() string { return proto.CompactTextString(m) }
func (*QueryLastZetaHeightRequest) ProtoMessage() {}
func (*QueryLastZetaHeightRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{47}
}
func (m *QueryLastZetaHeightRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryLastZetaHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryLastZetaHeightRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryLastZetaHeightRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryLastZetaHeightRequest.Merge(m, src)
}
func (m *QueryLastZetaHeightRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryLastZetaHeightRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryLastZetaHeightRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryLastZetaHeightRequest proto.InternalMessageInfo
type QueryLastZetaHeightResponse struct {
Height int64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"`
}
func (m *QueryLastZetaHeightResponse) Reset() { *m = QueryLastZetaHeightResponse{} }
func (m *QueryLastZetaHeightResponse) String() string { return proto.CompactTextString(m) }
func (*QueryLastZetaHeightResponse) ProtoMessage() {}
func (*QueryLastZetaHeightResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{48}
}
func (m *QueryLastZetaHeightResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryLastZetaHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryLastZetaHeightResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryLastZetaHeightResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryLastZetaHeightResponse.Merge(m, src)
}
func (m *QueryLastZetaHeightResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryLastZetaHeightResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryLastZetaHeightResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryLastZetaHeightResponse proto.InternalMessageInfo
func (m *QueryLastZetaHeightResponse) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
type QueryConvertGasToZetaRequest struct {
ChainId int64 `protobuf:"varint,1,opt,name=chainId,proto3" json:"chainId,omitempty"`
GasLimit string `protobuf:"bytes,2,opt,name=gasLimit,proto3" json:"gasLimit,omitempty"`
}
func (m *QueryConvertGasToZetaRequest) Reset() { *m = QueryConvertGasToZetaRequest{} }
func (m *QueryConvertGasToZetaRequest) String() string { return proto.CompactTextString(m) }
func (*QueryConvertGasToZetaRequest) ProtoMessage() {}
func (*QueryConvertGasToZetaRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{49}
}
func (m *QueryConvertGasToZetaRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryConvertGasToZetaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryConvertGasToZetaRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryConvertGasToZetaRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryConvertGasToZetaRequest.Merge(m, src)
}
func (m *QueryConvertGasToZetaRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryConvertGasToZetaRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryConvertGasToZetaRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryConvertGasToZetaRequest proto.InternalMessageInfo
func (m *QueryConvertGasToZetaRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *QueryConvertGasToZetaRequest) GetGasLimit() string {
if m != nil {
return m.GasLimit
}
return ""
}
type QueryConvertGasToZetaResponse struct {
OutboundGasInZeta string `protobuf:"bytes,1,opt,name=outboundGasInZeta,proto3" json:"outboundGasInZeta,omitempty"`
ProtocolFeeInZeta string `protobuf:"bytes,2,opt,name=protocolFeeInZeta,proto3" json:"protocolFeeInZeta,omitempty"`
ZetaBlockHeight uint64 `protobuf:"varint,3,opt,name=ZetaBlockHeight,proto3" json:"ZetaBlockHeight,omitempty"`
}
func (m *QueryConvertGasToZetaResponse) Reset() { *m = QueryConvertGasToZetaResponse{} }
func (m *QueryConvertGasToZetaResponse) String() string { return proto.CompactTextString(m) }
func (*QueryConvertGasToZetaResponse) ProtoMessage() {}
func (*QueryConvertGasToZetaResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{50}
}
func (m *QueryConvertGasToZetaResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryConvertGasToZetaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryConvertGasToZetaResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryConvertGasToZetaResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryConvertGasToZetaResponse.Merge(m, src)
}
func (m *QueryConvertGasToZetaResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryConvertGasToZetaResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryConvertGasToZetaResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryConvertGasToZetaResponse proto.InternalMessageInfo
func (m *QueryConvertGasToZetaResponse) GetOutboundGasInZeta() string {
if m != nil {
return m.OutboundGasInZeta
}
return ""
}
func (m *QueryConvertGasToZetaResponse) GetProtocolFeeInZeta() string {
if m != nil {
return m.ProtocolFeeInZeta
}
return ""
}
func (m *QueryConvertGasToZetaResponse) GetZetaBlockHeight() uint64 {
if m != nil {
return m.ZetaBlockHeight
}
return 0
}
type QueryMessagePassingProtocolFeeRequest struct {
}
func (m *QueryMessagePassingProtocolFeeRequest) Reset() { *m = QueryMessagePassingProtocolFeeRequest{} }
func (m *QueryMessagePassingProtocolFeeRequest) String() string { return proto.CompactTextString(m) }
func (*QueryMessagePassingProtocolFeeRequest) ProtoMessage() {}
func (*QueryMessagePassingProtocolFeeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{51}
}
func (m *QueryMessagePassingProtocolFeeRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryMessagePassingProtocolFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryMessagePassingProtocolFeeRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.Merge(m, src)
}
func (m *QueryMessagePassingProtocolFeeRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryMessagePassingProtocolFeeRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryMessagePassingProtocolFeeRequest proto.InternalMessageInfo
type QueryMessagePassingProtocolFeeResponse struct {
FeeInZeta string `protobuf:"bytes,1,opt,name=feeInZeta,proto3" json:"feeInZeta,omitempty"`
}
func (m *QueryMessagePassingProtocolFeeResponse) Reset() {
*m = QueryMessagePassingProtocolFeeResponse{}
}
func (m *QueryMessagePassingProtocolFeeResponse) String() string { return proto.CompactTextString(m) }
func (*QueryMessagePassingProtocolFeeResponse) ProtoMessage() {}
func (*QueryMessagePassingProtocolFeeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{52}
}
func (m *QueryMessagePassingProtocolFeeResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryMessagePassingProtocolFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryMessagePassingProtocolFeeResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.Merge(m, src)
}
func (m *QueryMessagePassingProtocolFeeResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryMessagePassingProtocolFeeResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryMessagePassingProtocolFeeResponse proto.InternalMessageInfo
func (m *QueryMessagePassingProtocolFeeResponse) GetFeeInZeta() string {
if m != nil {
return m.FeeInZeta
}
return ""
}
type QueryZEVMGetTransactionReceiptRequest struct {
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
}
func (m *QueryZEVMGetTransactionReceiptRequest) Reset() { *m = QueryZEVMGetTransactionReceiptRequest{} }
func (m *QueryZEVMGetTransactionReceiptRequest) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionReceiptRequest) ProtoMessage() {}
func (*QueryZEVMGetTransactionReceiptRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{53}
}
func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest.Merge(m, src)
}
func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryZEVMGetTransactionReceiptRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest proto.InternalMessageInfo
func (m *QueryZEVMGetTransactionReceiptRequest) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
type QueryZEVMGetTransactionReceiptResponse struct {
BlockHash string `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"`
BlockNumber string `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"`
ContractAddress string `protobuf:"bytes,3,opt,name=contract_address,json=contractAddress,proto3" json:"contractAddress"`
CumulativeGasUsed string `protobuf:"bytes,4,opt,name=cumulative_gas_used,json=cumulativeGasUsed,proto3" json:"cumulativeGasUsed"`
From string `protobuf:"bytes,5,opt,name=from,proto3" json:"from"`
GasUsed string `protobuf:"bytes,6,opt,name=gas_used,json=gasUsed,proto3" json:"gasUsed"`
LogsBloom string `protobuf:"bytes,7,opt,name=logs_bloom,json=logsBloom,proto3" json:"logsBloom"`
Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status"`
To string `protobuf:"bytes,9,opt,name=to,proto3" json:"to"`
TransactionHash string `protobuf:"bytes,10,opt,name=transaction_hash,json=transactionHash,proto3" json:"transactionHash"`
TransactionIndex string `protobuf:"bytes,11,opt,name=transaction_index,json=transactionIndex,proto3" json:"transactionIndex"`
Logs []*Log `protobuf:"bytes,12,rep,name=logs,proto3" json:"logs,omitempty"`
}
func (m *QueryZEVMGetTransactionReceiptResponse) Reset() {
*m = QueryZEVMGetTransactionReceiptResponse{}
}
func (m *QueryZEVMGetTransactionReceiptResponse) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionReceiptResponse) ProtoMessage() {}
func (*QueryZEVMGetTransactionReceiptResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{54}
}
func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse.Merge(m, src)
}
func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryZEVMGetTransactionReceiptResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse proto.InternalMessageInfo
func (m *QueryZEVMGetTransactionReceiptResponse) GetBlockHash() string {
if m != nil {
return m.BlockHash
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetBlockNumber() string {
if m != nil {
return m.BlockNumber
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetContractAddress() string {
if m != nil {
return m.ContractAddress
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetCumulativeGasUsed() string {
if m != nil {
return m.CumulativeGasUsed
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetFrom() string {
if m != nil {
return m.From
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetGasUsed() string {
if m != nil {
return m.GasUsed
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetLogsBloom() string {
if m != nil {
return m.LogsBloom
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetStatus() string {
if m != nil {
return m.Status
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetTo() string {
if m != nil {
return m.To
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetTransactionHash() string {
if m != nil {
return m.TransactionHash
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetTransactionIndex() string {
if m != nil {
return m.TransactionIndex
}
return ""
}
func (m *QueryZEVMGetTransactionReceiptResponse) GetLogs() []*Log {
if m != nil {
return m.Logs
}
return nil
}
type Log struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
Topics []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"`
Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
// sythetic fields
BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"`
TransactionHash string `protobuf:"bytes,5,opt,name=transaction_hash,json=transactionHash,proto3" json:"transactionHash"`
TransactionIndex uint64 `protobuf:"varint,6,opt,name=transaction_index,json=transactionIndex,proto3" json:"transactionIndex"`
BlockHash string `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"`
LogIndex uint64 `protobuf:"varint,8,opt,name=log_index,json=logIndex,proto3" json:"logIndex"`
Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed"`
}
func (m *Log) Reset() { *m = Log{} }
func (m *Log) String() string { return proto.CompactTextString(m) }
func (*Log) ProtoMessage() {}
func (*Log) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{55}
}
func (m *Log) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Log.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Log) XXX_Merge(src proto.Message) {
xxx_messageInfo_Log.Merge(m, src)
}
func (m *Log) XXX_Size() int {
return m.Size()
}
func (m *Log) XXX_DiscardUnknown() {
xxx_messageInfo_Log.DiscardUnknown(m)
}
var xxx_messageInfo_Log proto.InternalMessageInfo
func (m *Log) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
func (m *Log) GetTopics() []string {
if m != nil {
return m.Topics
}
return nil
}
func (m *Log) GetData() string {
if m != nil {
return m.Data
}
return ""
}
func (m *Log) GetBlockNumber() uint64 {
if m != nil {
return m.BlockNumber
}
return 0
}
func (m *Log) GetTransactionHash() string {
if m != nil {
return m.TransactionHash
}
return ""
}
func (m *Log) GetTransactionIndex() uint64 {
if m != nil {
return m.TransactionIndex
}
return 0
}
func (m *Log) GetBlockHash() string {
if m != nil {
return m.BlockHash
}
return ""
}
func (m *Log) GetLogIndex() uint64 {
if m != nil {
return m.LogIndex
}
return 0
}
func (m *Log) GetRemoved() bool {
if m != nil {
return m.Removed
}
return false
}
type QueryZEVMGetTransactionRequest struct {
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
}
func (m *QueryZEVMGetTransactionRequest) Reset() { *m = QueryZEVMGetTransactionRequest{} }
func (m *QueryZEVMGetTransactionRequest) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionRequest) ProtoMessage() {}
func (*QueryZEVMGetTransactionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{56}
}
func (m *QueryZEVMGetTransactionRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryZEVMGetTransactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryZEVMGetTransactionRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryZEVMGetTransactionRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryZEVMGetTransactionRequest.Merge(m, src)
}
func (m *QueryZEVMGetTransactionRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryZEVMGetTransactionRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryZEVMGetTransactionRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryZEVMGetTransactionRequest proto.InternalMessageInfo
func (m *QueryZEVMGetTransactionRequest) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
type QueryZEVMGetTransactionResponse struct {
BlockHash string `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"`
BlockNumber string `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"`
From string `protobuf:"bytes,3,opt,name=from,proto3" json:"from"`
Gas string `protobuf:"bytes,4,opt,name=gas,proto3" json:"gas"`
GasPrice string `protobuf:"bytes,5,opt,name=gas_price,json=gasPrice,proto3" json:"gasPrice"`
Hash string `protobuf:"bytes,6,opt,name=hash,proto3" json:"hash"`
Input string `protobuf:"bytes,7,opt,name=input,proto3" json:"input"`
Nonce string `protobuf:"bytes,8,opt,name=nonce,proto3" json:"nonce"`
To string `protobuf:"bytes,9,opt,name=to,proto3" json:"to"`
TransactionIndex string `protobuf:"bytes,10,opt,name=transaction_index,json=transactionIndex,proto3" json:"transactionIndex"`
Value string `protobuf:"bytes,11,opt,name=value,proto3" json:"value"`
Type string `protobuf:"bytes,12,opt,name=type,proto3" json:"type"`
AccessList []string `protobuf:"bytes,13,rep,name=access_list,json=accessList,proto3" json:"accessList"`
ChainId string `protobuf:"bytes,14,opt,name=chain_id,json=chainId,proto3" json:"chainId"`
V string `protobuf:"bytes,15,opt,name=v,proto3" json:"v"`
R string `protobuf:"bytes,16,opt,name=r,proto3" json:"r"`
S string `protobuf:"bytes,17,opt,name=s,proto3" json:"s"`
}
func (m *QueryZEVMGetTransactionResponse) Reset() { *m = QueryZEVMGetTransactionResponse{} }
func (m *QueryZEVMGetTransactionResponse) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionResponse) ProtoMessage() {}
func (*QueryZEVMGetTransactionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{57}
}
func (m *QueryZEVMGetTransactionResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryZEVMGetTransactionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryZEVMGetTransactionResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryZEVMGetTransactionResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryZEVMGetTransactionResponse.Merge(m, src)
}
func (m *QueryZEVMGetTransactionResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryZEVMGetTransactionResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryZEVMGetTransactionResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryZEVMGetTransactionResponse proto.InternalMessageInfo
func (m *QueryZEVMGetTransactionResponse) GetBlockHash() string {
if m != nil {
return m.BlockHash
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetBlockNumber() string {
if m != nil {
return m.BlockNumber
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetFrom() string {
if m != nil {
return m.From
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetGas() string {
if m != nil {
return m.Gas
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetGasPrice() string {
if m != nil {
return m.GasPrice
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetInput() string {
if m != nil {
return m.Input
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetNonce() string {
if m != nil {
return m.Nonce
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetTo() string {
if m != nil {
return m.To
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetTransactionIndex() string {
if m != nil {
return m.TransactionIndex
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetAccessList() []string {
if m != nil {
return m.AccessList
}
return nil
}
func (m *QueryZEVMGetTransactionResponse) GetChainId() string {
if m != nil {
return m.ChainId
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetV() string {
if m != nil {
return m.V
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetR() string {
if m != nil {
return m.R
}
return ""
}
func (m *QueryZEVMGetTransactionResponse) GetS() string {
if m != nil {
return m.S
}
return ""
}
type QueryZEVMGetBlockByNumberRequest struct {
Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
}
func (m *QueryZEVMGetBlockByNumberRequest) Reset() { *m = QueryZEVMGetBlockByNumberRequest{} }
func (m *QueryZEVMGetBlockByNumberRequest) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetBlockByNumberRequest) ProtoMessage() {}
func (*QueryZEVMGetBlockByNumberRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{58}
}
func (m *QueryZEVMGetBlockByNumberRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryZEVMGetBlockByNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryZEVMGetBlockByNumberRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryZEVMGetBlockByNumberRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryZEVMGetBlockByNumberRequest.Merge(m, src)
}
func (m *QueryZEVMGetBlockByNumberRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryZEVMGetBlockByNumberRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryZEVMGetBlockByNumberRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryZEVMGetBlockByNumberRequest proto.InternalMessageInfo
func (m *QueryZEVMGetBlockByNumberRequest) GetHeight() uint64 {
if m != nil {
return m.Height
}
return 0
}
type QueryZEVMGetBlockByNumberResponse struct {
Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number"`
Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash"`
ParentHash string `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parentHash"`
Nonce string `protobuf:"bytes,4,opt,name=nonce,proto3" json:"nonce"`
Sha3Uncles string `protobuf:"bytes,5,opt,name=sha3_uncles,json=sha3Uncles,proto3" json:"sha3Uncles"`
LogsBloom string `protobuf:"bytes,6,opt,name=logs_bloom,json=logsBloom,proto3" json:"logsBloom"`
TransactionsRoot string `protobuf:"bytes,7,opt,name=transactions_root,json=transactionsRoot,proto3" json:"transactionsRoot"`
StateRoot string `protobuf:"bytes,8,opt,name=state_root,json=stateRoot,proto3" json:"stateRoot"`
ReceiptsRoot string `protobuf:"bytes,9,opt,name=receipts_root,json=receiptsRoot,proto3" json:"receiptsRoot"`
Miner string `protobuf:"bytes,10,opt,name=miner,proto3" json:"miner"`
Difficulty string `protobuf:"bytes,11,opt,name=difficulty,proto3" json:"difficulty"`
TotalDifficulty string `protobuf:"bytes,12,opt,name=total_difficulty,json=totalDifficulty,proto3" json:"totalDifficulty"`
ExtraData string `protobuf:"bytes,13,opt,name=extra_data,json=extraData,proto3" json:"extraData"`
Size_ string `protobuf:"bytes,14,opt,name=size,proto3" json:"size"`
GasLimit string `protobuf:"bytes,15,opt,name=gas_limit,json=gasLimit,proto3" json:"gasLimit"`
GasUsed string `protobuf:"bytes,16,opt,name=gas_used,json=gasUsed,proto3" json:"gasUsed"`
Timestamp string `protobuf:"bytes,17,opt,name=timestamp,proto3" json:"timestamp"`
Transactions []string `protobuf:"bytes,18,rep,name=transactions,proto3" json:"transactions"`
Uncles []string `protobuf:"bytes,19,rep,name=uncles,proto3" json:"uncles"`
BaseFeePerGas string `protobuf:"bytes,20,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3" json:"baseFeePerGas"`
MixHash string `protobuf:"bytes,21,opt,name=mix_hash,json=mixHash,proto3" json:"mixHash"`
}
func (m *QueryZEVMGetBlockByNumberResponse) Reset() { *m = QueryZEVMGetBlockByNumberResponse{} }
func (m *QueryZEVMGetBlockByNumberResponse) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetBlockByNumberResponse) ProtoMessage() {}
func (*QueryZEVMGetBlockByNumberResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_65a992045e92a606, []int{59}
}
func (m *QueryZEVMGetBlockByNumberResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryZEVMGetBlockByNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryZEVMGetBlockByNumberResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryZEVMGetBlockByNumberResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryZEVMGetBlockByNumberResponse.Merge(m, src)
}
func (m *QueryZEVMGetBlockByNumberResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryZEVMGetBlockByNumberResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryZEVMGetBlockByNumberResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryZEVMGetBlockByNumberResponse proto.InternalMessageInfo
func (m *QueryZEVMGetBlockByNumberResponse) GetNumber() string {
if m != nil {
return m.Number
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetParentHash() string {
if m != nil {
return m.ParentHash
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetNonce() string {
if m != nil {
return m.Nonce
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetSha3Uncles() string {
if m != nil {
return m.Sha3Uncles
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetLogsBloom() string {
if m != nil {
return m.LogsBloom
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetTransactionsRoot() string {
if m != nil {
return m.TransactionsRoot
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetStateRoot() string {
if m != nil {
return m.StateRoot
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetReceiptsRoot() string {
if m != nil {
return m.ReceiptsRoot
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetMiner() string {
if m != nil {
return m.Miner
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetDifficulty() string {
if m != nil {
return m.Difficulty
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetTotalDifficulty() string {
if m != nil {
return m.TotalDifficulty
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetExtraData() string {
if m != nil {
return m.ExtraData
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetSize_() string {
if m != nil {
return m.Size_
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetGasLimit() string {
if m != nil {
return m.GasLimit
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetGasUsed() string {
if m != nil {
return m.GasUsed
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetTimestamp() string {
if m != nil {
return m.Timestamp
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetTransactions() []string {
if m != nil {
return m.Transactions
}
return nil
}
func (m *QueryZEVMGetBlockByNumberResponse) GetUncles() []string {
if m != nil {
return m.Uncles
}
return nil
}
func (m *QueryZEVMGetBlockByNumberResponse) GetBaseFeePerGas() string {
if m != nil {
return m.BaseFeePerGas
}
return ""
}
func (m *QueryZEVMGetBlockByNumberResponse) GetMixHash() string {
if m != nil {
return m.MixHash
}
return ""
}
func init() {
proto.RegisterType((*QueryTssHistoryRequest)(nil), "zetachain.zetacore.crosschain.QueryTssHistoryRequest")
proto.RegisterType((*QueryTssHistoryResponse)(nil), "zetachain.zetacore.crosschain.QueryTssHistoryResponse")
proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.crosschain.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.crosschain.QueryParamsResponse")
proto.RegisterType((*QueryGetOutTxTrackerRequest)(nil), "zetachain.zetacore.crosschain.QueryGetOutTxTrackerRequest")
proto.RegisterType((*QueryGetOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.QueryGetOutTxTrackerResponse")
proto.RegisterType((*QueryAllOutTxTrackerRequest)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerRequest")
proto.RegisterType((*QueryAllOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerResponse")
proto.RegisterType((*QueryAllOutTxTrackerByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerByChainRequest")
proto.RegisterType((*QueryAllOutTxTrackerByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerByChainResponse")
proto.RegisterType((*QueryAllInTxTrackerByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackerByChainRequest")
proto.RegisterType((*QueryAllInTxTrackerByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackerByChainResponse")
proto.RegisterType((*QueryAllInTxTrackersRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackersRequest")
proto.RegisterType((*QueryAllInTxTrackersResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackersResponse")
proto.RegisterType((*QueryGetInTxHashToCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryGetInTxHashToCctxRequest")
proto.RegisterType((*QueryGetInTxHashToCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryGetInTxHashToCctxResponse")
proto.RegisterType((*QueryInTxHashToCctxDataRequest)(nil), "zetachain.zetacore.crosschain.QueryInTxHashToCctxDataRequest")
proto.RegisterType((*QueryInTxHashToCctxDataResponse)(nil), "zetachain.zetacore.crosschain.QueryInTxHashToCctxDataResponse")
proto.RegisterType((*QueryAllInTxHashToCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxHashToCctxRequest")
proto.RegisterType((*QueryAllInTxHashToCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxHashToCctxResponse")
proto.RegisterType((*QueryGetTssAddressRequest)(nil), "zetachain.zetacore.crosschain.QueryGetTssAddressRequest")
proto.RegisterType((*QueryGetTssAddressResponse)(nil), "zetachain.zetacore.crosschain.QueryGetTssAddressResponse")
proto.RegisterType((*QueryGetTSSRequest)(nil), "zetachain.zetacore.crosschain.QueryGetTSSRequest")
proto.RegisterType((*QueryGetTSSResponse)(nil), "zetachain.zetacore.crosschain.QueryGetTSSResponse")
proto.RegisterType((*QueryGetGasPriceRequest)(nil), "zetachain.zetacore.crosschain.QueryGetGasPriceRequest")
proto.RegisterType((*QueryGetGasPriceResponse)(nil), "zetachain.zetacore.crosschain.QueryGetGasPriceResponse")
proto.RegisterType((*QueryAllGasPriceRequest)(nil), "zetachain.zetacore.crosschain.QueryAllGasPriceRequest")
proto.RegisterType((*QueryAllGasPriceResponse)(nil), "zetachain.zetacore.crosschain.QueryAllGasPriceResponse")
proto.RegisterType((*QueryGetChainNoncesRequest)(nil), "zetachain.zetacore.crosschain.QueryGetChainNoncesRequest")
proto.RegisterType((*QueryGetChainNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryGetChainNoncesResponse")
proto.RegisterType((*QueryAllChainNoncesRequest)(nil), "zetachain.zetacore.crosschain.QueryAllChainNoncesRequest")
proto.RegisterType((*QueryAllChainNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryAllChainNoncesResponse")
proto.RegisterType((*QueryAllPendingNoncesRequest)(nil), "zetachain.zetacore.crosschain.QueryAllPendingNoncesRequest")
proto.RegisterType((*QueryAllPendingNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryAllPendingNoncesResponse")
proto.RegisterType((*QueryPendingNoncesByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryPendingNoncesByChainRequest")
proto.RegisterType((*QueryPendingNoncesByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryPendingNoncesByChainResponse")
proto.RegisterType((*QueryGetLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightRequest")
proto.RegisterType((*QueryGetLastBlockHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightResponse")
proto.RegisterType((*QueryAllLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryAllLastBlockHeightRequest")
proto.RegisterType((*QueryAllLastBlockHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryAllLastBlockHeightResponse")
proto.RegisterType((*QueryGetCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryGetCctxRequest")
proto.RegisterType((*QueryGetCctxByNonceRequest)(nil), "zetachain.zetacore.crosschain.QueryGetCctxByNonceRequest")
proto.RegisterType((*QueryGetCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryGetCctxResponse")
proto.RegisterType((*QueryAllCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryAllCctxRequest")
proto.RegisterType((*QueryAllCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryAllCctxResponse")
proto.RegisterType((*QueryAllCctxPendingRequest)(nil), "zetachain.zetacore.crosschain.QueryAllCctxPendingRequest")
proto.RegisterType((*QueryAllCctxPendingResponse)(nil), "zetachain.zetacore.crosschain.QueryAllCctxPendingResponse")
proto.RegisterType((*QueryLastZetaHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryLastZetaHeightRequest")
proto.RegisterType((*QueryLastZetaHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryLastZetaHeightResponse")
proto.RegisterType((*QueryConvertGasToZetaRequest)(nil), "zetachain.zetacore.crosschain.QueryConvertGasToZetaRequest")
proto.RegisterType((*QueryConvertGasToZetaResponse)(nil), "zetachain.zetacore.crosschain.QueryConvertGasToZetaResponse")
proto.RegisterType((*QueryMessagePassingProtocolFeeRequest)(nil), "zetachain.zetacore.crosschain.QueryMessagePassingProtocolFeeRequest")
proto.RegisterType((*QueryMessagePassingProtocolFeeResponse)(nil), "zetachain.zetacore.crosschain.QueryMessagePassingProtocolFeeResponse")
proto.RegisterType((*QueryZEVMGetTransactionReceiptRequest)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptRequest")
proto.RegisterType((*QueryZEVMGetTransactionReceiptResponse)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptResponse")
proto.RegisterType((*Log)(nil), "zetachain.zetacore.crosschain.Log")
proto.RegisterType((*QueryZEVMGetTransactionRequest)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionRequest")
proto.RegisterType((*QueryZEVMGetTransactionResponse)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionResponse")
proto.RegisterType((*QueryZEVMGetBlockByNumberRequest)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberRequest")
proto.RegisterType((*QueryZEVMGetBlockByNumberResponse)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberResponse")
}
func init() { proto.RegisterFile("crosschain/query.proto", fileDescriptor_65a992045e92a606) }
var fileDescriptor_65a992045e92a606 = []byte{
// 3151 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5b, 0xdd, 0x6f, 0x1b, 0xc7,
0x11, 0xf7, 0x89, 0xfa, 0x5c, 0x4a, 0x96, 0xbc, 0x56, 0x1c, 0x86, 0xb1, 0x45, 0xe7, 0x1c, 0x5b,
0x8e, 0x3f, 0xc8, 0x58, 0xb1, 0x95, 0xc4, 0x76, 0xd2, 0x48, 0x76, 0xac, 0x18, 0x51, 0x12, 0xf5,
0xa4, 0xf4, 0xc3, 0x45, 0x4b, 0x9c, 0xc8, 0x35, 0x75, 0x30, 0xc9, 0x63, 0x6e, 0x97, 0x82, 0x14,
0x43, 0x2d, 0x90, 0x87, 0x3e, 0x07, 0x28, 0xd0, 0xbe, 0xf4, 0xb5, 0x1f, 0x0f, 0x7d, 0x28, 0xd0,
0xa0, 0x29, 0x50, 0x20, 0x45, 0xd1, 0xd6, 0xcd, 0x63, 0xd0, 0x02, 0x45, 0x3f, 0x00, 0xa2, 0x48,
0xfa, 0xc4, 0xff, 0xa0, 0x40, 0x1f, 0x8a, 0x9d, 0x9b, 0xe3, 0xed, 0xf1, 0xee, 0xc4, 0x13, 0xc5,
0x04, 0xed, 0x8b, 0xb8, 0x3b, 0x7b, 0x33, 0xfb, 0x9b, 0xd9, 0x99, 0xdd, 0xd9, 0x9b, 0x13, 0x39,
0x51, 0x72, 0x6c, 0xce, 0x4b, 0x5b, 0xa6, 0x55, 0x2f, 0xbc, 0xd3, 0x64, 0xce, 0x6e, 0xbe, 0xe1,
0xd8, 0xc2, 0xa6, 0xa7, 0xde, 0x65, 0xc2, 0x04, 0x72, 0x1e, 0x5a, 0xb6, 0xc3, 0xf2, 0xfe, 0xa3,
0xd9, 0x0b, 0x25, 0x9b, 0xd7, 0x6c, 0x5e, 0xd8, 0x34, 0x39, 0x73, 0xf9, 0x0a, 0xdb, 0x57, 0x36,
0x99, 0x30, 0xaf, 0x14, 0x1a, 0x66, 0xc5, 0xaa, 0x9b, 0xc2, 0xb2, 0xeb, 0xae, 0xa8, 0xec, 0x29,
0x65, 0x0a, 0xf8, 0x5b, 0xac, 0xdb, 0xf5, 0x12, 0xe3, 0x38, 0x9c, 0x53, 0x87, 0x65, 0xb3, 0xe8,
0x3e, 0x24, 0x76, 0xf0, 0x81, 0xac, 0xf2, 0x40, 0xc5, 0xe4, 0xc5, 0x86, 0x63, 0x95, 0x18, 0x8e,
0x9d, 0x51, 0xc6, 0x80, 0xa7, 0xb8, 0x65, 0xf2, 0xad, 0xa2, 0xb0, 0x8b, 0xa5, 0x52, 0x47, 0xc0,
0x5c, 0xe8, 0x21, 0xe1, 0x98, 0xa5, 0x07, 0xcc, 0xc1, 0x71, 0x5d, 0x19, 0xaf, 0x9a, 0x5c, 0x14,
0x37, 0xab, 0x76, 0xe9, 0x41, 0x71, 0x8b, 0x59, 0x95, 0x2d, 0x11, 0x21, 0x03, 0xe0, 0x77, 0xcd,
0xa1, 0x6a, 0x61, 0x37, 0x45, 0x78, 0x92, 0xc7, 0x95, 0x07, 0x1a, 0xa6, 0x63, 0xd6, 0x3c, 0xfd,
0x67, 0x95, 0x01, 0xc1, 0x3b, 0xd4, 0x8a, 0x5d, 0xb1, 0xa1, 0x59, 0x90, 0x2d, 0xa4, 0x9e, 0xac,
0xd8, 0x76, 0xa5, 0xca, 0x0a, 0x66, 0xc3, 0x2a, 0x98, 0xf5, 0xba, 0x2d, 0xc0, 0xce, 0xc8, 0xa3,
0x67, 0xc8, 0x89, 0x2f, 0xcb, 0xa5, 0xd8, 0xe0, 0xfc, 0x35, 0x8b, 0x0b, 0xdb, 0xd9, 0x35, 0xd8,
0x3b, 0x4d, 0xc6, 0x85, 0xfe, 0x2d, 0xf2, 0x78, 0x68, 0x84, 0x37, 0xec, 0x3a, 0x67, 0xf4, 0x16,
0x19, 0x17, 0x9c, 0x17, 0xab, 0x16, 0x17, 0x19, 0xed, 0x74, 0xea, 0x7c, 0x7a, 0x41, 0xcf, 0xef,
0xbb, 0xf6, 0xf9, 0x8d, 0xf5, 0xf5, 0xe5, 0xe1, 0x8f, 0x5b, 0xb9, 0x23, 0xc6, 0x98, 0xe0, 0x7c,
0xd5, 0xe2, 0x42, 0x9f, 0x25, 0x14, 0xe4, 0xaf, 0x81, 0x62, 0xde, 0xac, 0xf7, 0xc8, 0xf1, 0x00,
0xb5, 0x33, 0xe3, 0xa8, 0x6b, 0x80, 0x8c, 0x76, 0x5a, 0x3b, 0x9f, 0x5e, 0x38, 0xdb, 0x63, 0x3e,
0x97, 0x1d, 0xa7, 0x44, 0x56, 0xfd, 0x0d, 0xf2, 0x24, 0xc8, 0x5e, 0x61, 0xe2, 0xad, 0xa6, 0xd8,
0xd8, 0xd9, 0x70, 0x8d, 0x8d, 0x53, 0xd3, 0x0c, 0x19, 0x03, 0xe6, 0xbb, 0xb7, 0x61, 0x92, 0x94,
0xe1, 0x75, 0xe9, 0x2c, 0x19, 0x81, 0xf5, 0xcb, 0x0c, 0x9d, 0xd6, 0xce, 0x0f, 0x1b, 0x6e, 0x47,
0x6f, 0x92, 0x93, 0xd1, 0xe2, 0x10, 0xf3, 0xdb, 0x64, 0xd2, 0x56, 0xe8, 0x88, 0xfc, 0x62, 0x0f,
0xe4, 0xaa, 0x28, 0xc4, 0x1f, 0x10, 0xa3, 0x33, 0xd4, 0x62, 0xa9, 0x5a, 0x8d, 0xd2, 0xe2, 0x0e,
0x21, 0x7e, 0x34, 0xe1, 0x9c, 0xe7, 0xf2, 0x6e, 0xe8, 0xe5, 0x65, 0xe8, 0xe5, 0xdd, 0x90, 0xc5,
0xd0, 0xcb, 0xaf, 0x99, 0x15, 0x86, 0xbc, 0x86, 0xc2, 0xa9, 0x7f, 0xa4, 0xa1, 0x7a, 0xa1, 0x79,
0x62, 0xd5, 0x4b, 0x0d, 0x40, 0x3d, 0xba, 0x12, 0xc0, 0x3f, 0x04, 0xf8, 0xe7, 0x7b, 0xe2, 0x77,
0x31, 0x05, 0x14, 0x78, 0x4f, 0x23, 0x7a, 0x94, 0x02, 0xcb, 0xbb, 0xb7, 0x24, 0x12, 0xcf, 0x5e,
0xb3, 0x64, 0x04, 0x90, 0xe1, 0x9a, 0xbb, 0x9d, 0x2e, 0x2b, 0x0e, 0xf5, 0x6d, 0xc5, 0x3f, 0x68,
0xe4, 0xcc, 0xbe, 0x20, 0xfe, 0x4f, 0x8c, 0xf9, 0x5d, 0x8d, 0x3c, 0xe5, 0xe9, 0x71, 0xb7, 0x1e,
0x67, 0xcb, 0x27, 0xc8, 0xb8, 0xbb, 0x0f, 0x5b, 0xe5, 0x60, 0x08, 0x95, 0x07, 0x66, 0xd0, 0xdf,
0x2a, 0xab, 0x1a, 0x05, 0x04, 0xed, 0x69, 0x90, 0xb4, 0x55, 0xef, 0x36, 0xe7, 0x85, 0x1e, 0xe6,
0x54, 0xe5, 0xb9, 0xd6, 0x54, 0x85, 0x0c, 0xce, 0x98, 0xa7, 0xfc, 0x08, 0x56, 0xa6, 0xec, 0x6c,
0x81, 0x8e, 0x1f, 0x78, 0xc1, 0xe1, 0xcf, 0x4f, 0x37, 0xfd, 0x06, 0x39, 0xe5, 0xed, 0x65, 0xf2,
0xc9, 0xd7, 0x4c, 0xbe, 0xb5, 0x61, 0xdf, 0x2a, 0x89, 0x1d, 0x6f, 0x69, 0xb3, 0x64, 0xdc, 0xc2,
0x01, 0x58, 0xda, 0x09, 0xa3, 0xd3, 0xd7, 0xf7, 0xc8, 0x5c, 0x1c, 0x33, 0x42, 0xfe, 0x06, 0x39,
0x6a, 0x05, 0x46, 0x70, 0x63, 0xba, 0x9c, 0x00, 0xb5, 0xcf, 0x84, 0xc0, 0xbb, 0x44, 0xe9, 0x37,
0x71, 0xfa, 0xe0, 0xc3, 0xb7, 0x4d, 0x61, 0x26, 0x01, 0xff, 0x2e, 0xc9, 0xc5, 0x72, 0x23, 0xfa,
0xaf, 0x92, 0xa9, 0x5b, 0x12, 0x13, 0xb8, 0xd8, 0xc6, 0x0e, 0x4f, 0x18, 0x9d, 0x2a, 0x0f, 0x42,
0x0f, 0xca, 0xd1, 0x2b, 0x68, 0x75, 0x5c, 0xe9, 0xb0, 0xd5, 0x07, 0xb5, 0x99, 0x3f, 0xd2, 0xd0,
0x46, 0x11, 0x33, 0xed, 0xb3, 0x44, 0xa9, 0x01, 0x2d, 0xd1, 0xe0, 0x42, 0xe7, 0x06, 0x79, 0xc2,
0x73, 0xb5, 0x0d, 0xce, 0x97, 0xca, 0x65, 0x87, 0x71, 0x2f, 0x70, 0xe8, 0x1c, 0x49, 0xcb, 0xb4,
0xa4, 0xd1, 0xdc, 0x2c, 0x3e, 0x60, 0xbb, 0xb8, 0xd2, 0x13, 0x82, 0xf3, 0xb5, 0xe6, 0xe6, 0xeb,
0x6c, 0x57, 0x7f, 0x85, 0x64, 0xa3, 0x98, 0xd1, 0x00, 0x33, 0x24, 0xc5, 0x84, 0xe7, 0x1f, 0xb2,
0x29, 0x29, 0x9b, 0xa2, 0x04, 0x70, 0x27, 0x0c, 0xd9, 0xec, 0xe4, 0x2c, 0x52, 0xc2, 0xfa, 0xba,
0x17, 0xb0, 0xaf, 0x63, 0xce, 0xe2, 0x51, 0x51, 0xe0, 0x55, 0x92, 0xda, 0x58, 0x5f, 0xc7, 0x55,
0x4b, 0x90, 0x20, 0x19, 0xf2, 0x71, 0xbd, 0x80, 0x69, 0xd7, 0x0a, 0x13, 0x2b, 0x26, 0x5f, 0x93,
0x79, 0xab, 0x72, 0x54, 0x59, 0xf5, 0x32, 0xdb, 0x41, 0x8c, 0x6e, 0x47, 0x2f, 0x92, 0x4c, 0x98,
0xc1, 0x4f, 0xd4, 0x3c, 0x1a, 0xe2, 0x98, 0xef, 0x81, 0xa3, 0x23, 0xa2, 0xc3, 0xa8, 0x9b, 0x88,
0x68, 0xa9, 0x5a, 0xed, 0x46, 0x34, 0x28, 0xff, 0xfc, 0xa9, 0x86, 0x4a, 0x04, 0xe6, 0x88, 0x54,
0x22, 0xd5, 0x97, 0x12, 0x83, 0xf3, 0xc0, 0x05, 0xdf, 0x89, 0x20, 0x8e, 0xdf, 0x84, 0x7b, 0xc9,
0xfe, 0x4b, 0xf4, 0xc0, 0x4f, 0x3c, 0x03, 0x3c, 0xa8, 0xe0, 0x2a, 0x49, 0x2b, 0x64, 0x34, 0x63,
0xaf, 0x0d, 0x5d, 0x15, 0xa4, 0xb2, 0xeb, 0x65, 0x04, 0xb8, 0x54, 0xad, 0x46, 0x00, 0x1c, 0xd4,
0x8a, 0x7d, 0xa0, 0xf9, 0x87, 0x58, 0x22, 0x9d, 0x52, 0x87, 0xd0, 0x69, 0x70, 0xab, 0x37, 0xe7,
0x9f, 0xad, 0x6b, 0xac, 0x5e, 0xb6, 0xea, 0x95, 0x80, 0x79, 0x74, 0xe1, 0xef, 0xc8, 0x5d, 0xe3,
0xa8, 0xd7, 0x3a, 0x39, 0xda, 0x70, 0x07, 0xf0, 0x46, 0x8a, 0xaa, 0x5d, 0xea, 0x75, 0x21, 0x09,
0x48, 0x9b, 0x6a, 0xa8, 0x5d, 0xfd, 0x25, 0x72, 0xda, 0xbd, 0xf4, 0xa8, 0xd4, 0xc4, 0xb9, 0x95,
0xfe, 0x6d, 0xcc, 0xcd, 0xa2, 0xd9, 0x11, 0xf8, 0xd7, 0x23, 0x80, 0x6b, 0x07, 0x05, 0xee, 0x1d,
0x63, 0x41, 0xf8, 0x8b, 0xfe, 0xf9, 0xbf, 0x6a, 0x72, 0xb1, 0x2c, 0x6f, 0xc2, 0xaf, 0xc1, 0x45,
0x78, 0xff, 0xb0, 0x78, 0x88, 0x47, 0x6f, 0x14, 0x1f, 0xa2, 0xfe, 0x1a, 0x99, 0xee, 0x1a, 0x42,
0xd8, 0xf9, 0x1e, 0xb0, 0xbb, 0x05, 0x76, 0x8b, 0xd1, 0xb7, 0xfc, 0x13, 0x31, 0x06, 0xf4, 0xa0,
0x42, 0xe5, 0xf7, 0x1a, 0xea, 0x19, 0x35, 0xd5, 0x7e, 0x7a, 0xa6, 0x06, 0xa0, 0xe7, 0xe0, 0x42,
0xe7, 0xa2, 0x7f, 0xca, 0xa9, 0x29, 0x4a, 0xf4, 0xd2, 0xae, 0x2a, 0xbb, 0xa4, 0x4c, 0x0b, 0x76,
0xc1, 0x55, 0xfa, 0xbd, 0x69, 0x57, 0xc8, 0x6c, 0x70, 0x6a, 0xb4, 0xda, 0x5b, 0x64, 0x52, 0x4d,
0xa8, 0x12, 0xde, 0xb0, 0x55, 0x16, 0x23, 0x20, 0x40, 0xff, 0x26, 0xea, 0x28, 0x37, 0xb5, 0xcf,
0x21, 0x0d, 0xfb, 0xb9, 0x86, 0x8a, 0x74, 0xe4, 0xc7, 0x2a, 0x92, 0x3a, 0x94, 0x22, 0x83, 0x5b,
0xf5, 0xef, 0x28, 0xa7, 0x49, 0x49, 0xec, 0xe0, 0x6e, 0xf0, 0x05, 0x5e, 0xf8, 0x3e, 0x54, 0x0f,
0x1a, 0x15, 0xc1, 0xff, 0xbc, 0xe9, 0x4e, 0xa2, 0xe9, 0x64, 0x44, 0xde, 0x63, 0xc2, 0x0c, 0xec,
0x2e, 0xfa, 0x35, 0x54, 0xab, 0x7b, 0x14, 0xd5, 0x3a, 0x41, 0x46, 0x95, 0xfd, 0x2e, 0x65, 0x60,
0x4f, 0xdf, 0xc0, 0x03, 0xec, 0x96, 0x5d, 0xdf, 0x66, 0x8e, 0xcc, 0xf8, 0x36, 0x6c, 0xc9, 0x1e,
0x0a, 0xad, 0xd0, 0x82, 0x64, 0xc9, 0x78, 0xc5, 0xe4, 0xab, 0x56, 0xcd, 0x12, 0x98, 0xd2, 0x76,
0xfa, 0xfa, 0x8f, 0x34, 0x3c, 0xf7, 0xc2, 0x62, 0x11, 0xcf, 0x25, 0x72, 0xcc, 0x6e, 0x8a, 0x4d,
0xbb, 0x59, 0x2f, 0xaf, 0x98, 0xfc, 0x6e, 0x5d, 0x0e, 0x62, 0xc8, 0x87, 0x07, 0xe4, 0xd3, 0xf0,
0x7a, 0xb1, 0x64, 0x57, 0xef, 0x30, 0x86, 0x4f, 0xbb, 0x93, 0x86, 0x07, 0xe8, 0x79, 0x32, 0x2d,
0x7f, 0xd5, 0xcd, 0x2f, 0x05, 0xe1, 0xdf, 0x4d, 0xd6, 0xe7, 0xc9, 0x59, 0x80, 0xf9, 0x06, 0xe3,
0xdc, 0xac, 0xb0, 0x35, 0x93, 0x73, 0xab, 0x5e, 0x59, 0xf3, 0x25, 0x7a, 0xd6, 0xbd, 0x43, 0xce,
0xf5, 0x7a, 0x10, 0x15, 0x3b, 0x49, 0x26, 0xee, 0x77, 0x20, 0xe2, 0x95, 0xa1, 0x43, 0xd0, 0x6f,
0xe0, 0x84, 0xf7, 0x5e, 0xfd, 0xca, 0x1b, 0x32, 0xbd, 0x77, 0xcc, 0x3a, 0x37, 0x4b, 0x72, 0x79,
0x0d, 0x56, 0x62, 0x56, 0xa3, 0x73, 0x58, 0x50, 0x32, 0xbc, 0xe5, 0x5f, 0x2f, 0xa1, 0xad, 0xff,
0x67, 0x18, 0x51, 0xec, 0xc3, 0xdd, 0x31, 0x2f, 0xc1, 0x17, 0xc8, 0x1d, 0x21, 0xcb, 0x53, 0xed,
0x56, 0x6e, 0x02, 0xa8, 0xf2, 0x26, 0x65, 0xf8, 0x4d, 0xba, 0x40, 0x26, 0xdd, 0xa7, 0xeb, 0xcd,
0xda, 0x26, 0x73, 0x5c, 0xcb, 0x2e, 0x4f, 0xb7, 0x5b, 0xb9, 0x34, 0xd0, 0xdf, 0x04, 0xb2, 0xa1,
0x76, 0xe8, 0xcb, 0x64, 0xa6, 0x64, 0xd7, 0x85, 0x63, 0x96, 0x44, 0xd1, 0x74, 0xaf, 0x3e, 0x60,
0xe5, 0x89, 0xe5, 0xe3, 0xed, 0x56, 0x6e, 0xda, 0x1b, 0xf3, 0x6e, 0x45, 0xdd, 0x04, 0xfa, 0x2a,
0x39, 0x5e, 0x6a, 0xd6, 0x9a, 0x55, 0x53, 0x58, 0xdb, 0xac, 0x58, 0x31, 0x79, 0xb1, 0xc9, 0x59,
0x39, 0x33, 0x0c, 0x22, 0x1e, 0x6b, 0xb7, 0x72, 0xc7, 0xfc, 0xe1, 0x15, 0x93, 0xbf, 0xcd, 0x59,
0xd9, 0x08, 0x93, 0xe8, 0x49, 0x32, 0x7c, 0xdf, 0xb1, 0x6b, 0x99, 0x11, 0xe0, 0x1b, 0x6f, 0xb7,
0x72, 0xd0, 0x37, 0xe0, 0x2f, 0x3d, 0x07, 0x3e, 0xea, 0x4a, 0x1e, 0x85, 0x27, 0xd2, 0xed, 0x56,
0x6e, 0xac, 0x82, 0xf2, 0xbc, 0x86, 0x34, 0x57, 0xd5, 0xae, 0xf0, 0xe2, 0x66, 0xd5, 0xb6, 0x6b,
0x99, 0x31, 0xdf, 0x5c, 0x92, 0xba, 0x2c, 0x89, 0x86, 0xdf, 0xa4, 0x3a, 0x19, 0xe5, 0xc2, 0x14,
0x4d, 0x9e, 0x19, 0x87, 0x27, 0x49, 0xbb, 0x95, 0x43, 0x8a, 0x81, 0xbf, 0xf4, 0x04, 0x19, 0x12,
0x76, 0x66, 0x02, 0xc6, 0x47, 0xdb, 0xad, 0xdc, 0x90, 0xb0, 0x8d, 0x21, 0x61, 0x4b, 0xb3, 0x09,
0x7f, 0xd9, 0xdc, 0xe5, 0x21, 0xbe, 0xd9, 0x94, 0x31, 0x58, 0xa4, 0x6e, 0x02, 0x5d, 0x22, 0xc7,
0x54, 0x7e, 0xf7, 0xa8, 0x4c, 0x83, 0x80, 0xd9, 0x76, 0x2b, 0xa7, 0x0a, 0xbf, 0x2b, 0xc7, 0x8c,
0x10, 0x85, 0x2e, 0x92, 0x61, 0xa9, 0x4b, 0x66, 0x32, 0xd1, 0x9b, 0xf6, 0x55, 0xbb, 0x62, 0xc0,
0xf3, 0xfa, 0x7b, 0x29, 0x92, 0x5a, 0xb5, 0x2b, 0x72, 0x4b, 0xf0, 0x16, 0xdc, 0xf5, 0x4e, 0xaf,
0x2b, 0x37, 0x19, 0x61, 0x37, 0xac, 0x12, 0xcf, 0x0c, 0x9d, 0x4e, 0x9d, 0x9f, 0x30, 0xb0, 0x27,
0x9d, 0xb9, 0x6c, 0x0a, 0xd3, 0xf5, 0x0f, 0x03, 0xda, 0x21, 0x9f, 0x93, 0x0b, 0x3f, 0xdc, 0xdb,
0xe7, 0x42, 0xc6, 0x1b, 0x39, 0xac, 0xf1, 0x46, 0x61, 0xe2, 0xa4, 0xc6, 0x0b, 0x06, 0xd6, 0x58,
0x8f, 0xc0, 0x7a, 0x86, 0x48, 0xb7, 0xc1, 0x89, 0xc6, 0x61, 0xa2, 0xc9, 0x76, 0x2b, 0x37, 0x5e,
0xb5, 0x2b, 0xee, 0x04, 0x9d, 0x16, 0x3d, 0x4b, 0xc6, 0x1c, 0x56, 0xb3, 0xb7, 0x59, 0x19, 0xbc,
0x66, 0xdc, 0xf5, 0x54, 0x24, 0x19, 0x5e, 0x43, 0xbf, 0x8a, 0x69, 0x66, 0xd4, 0x16, 0x10, 0xbf,
0x73, 0xfc, 0x7b, 0x18, 0x53, 0xc6, 0x28, 0xb6, 0x2f, 0x6c, 0xcb, 0xf0, 0x62, 0x35, 0x15, 0x19,
0xab, 0x4f, 0x90, 0x54, 0xc5, 0xe4, 0xb8, 0x01, 0x8c, 0xb5, 0x5b, 0x39, 0xd9, 0x35, 0xe4, 0x1f,
0x69, 0xc6, 0x4e, 0xd1, 0x0d, 0x17, 0x1c, 0xcc, 0x58, 0xe9, 0xdc, 0xcb, 0xbd, 0x96, 0x9c, 0x03,
0xf0, 0x8f, 0xfa, 0x73, 0xc8, 0xbe, 0x6b, 0x07, 0x9a, 0x93, 0xc9, 0x65, 0xa3, 0x29, 0x70, 0xe1,
0x26, 0xda, 0xad, 0x9c, 0x4b, 0x30, 0xdc, 0x1f, 0xf9, 0x80, 0x9b, 0x2f, 0x8e, 0xfb, 0x0f, 0x00,
0x01, 0x53, 0xc7, 0xd8, 0xb8, 0x8e, 0x74, 0x2d, 0x72, 0xa0, 0xb8, 0xcc, 0x91, 0x91, 0x6d, 0xb3,
0xda, 0x64, 0x18, 0xce, 0x30, 0x37, 0x10, 0x0c, 0xf7, 0x47, 0xea, 0x26, 0x76, 0x1b, 0x2c, 0x33,
0xe9, 0xeb, 0x26, 0xfb, 0x06, 0xfc, 0xa5, 0x05, 0x92, 0x36, 0x4b, 0x25, 0xe6, 0xd5, 0xd1, 0xa6,
0x64, 0x04, 0x2e, 0x1f, 0x6d, 0xb7, 0x72, 0xc4, 0x25, 0xaf, 0x5a, 0x32, 0x13, 0xf2, 0xdb, 0x72,
0x73, 0xec, 0x24, 0x5b, 0x47, 0xfd, 0xcd, 0x11, 0xcf, 0x77, 0xff, 0xa0, 0x3f, 0x4e, 0xb4, 0xed,
0xcc, 0x34, 0x3c, 0x30, 0xd2, 0x6e, 0xe5, 0xb4, 0x6d, 0x43, 0xdb, 0x96, 0x44, 0x27, 0x33, 0xe3,
0x13, 0x1d, 0x43, 0x73, 0x24, 0x91, 0x67, 0x8e, 0xf9, 0x44, 0x6e, 0x68, 0x5c, 0xbf, 0x8e, 0x97,
0x51, 0x74, 0x3d, 0x38, 0x7e, 0x97, 0x77, 0xd1, 0x3f, 0xd0, 0x67, 0x4f, 0x90, 0xd1, 0x2d, 0x3f,
0x3b, 0x19, 0x36, 0xb0, 0xa7, 0xff, 0x6d, 0x0c, 0xaf, 0xa2, 0xd1, 0xcc, 0xe8, 0xb9, 0x3a, 0x19,
0x45, 0x2f, 0xd4, 0xfc, 0xfd, 0xd8, 0xa5, 0x18, 0xf8, 0xdb, 0xf1, 0x8b, 0xa1, 0x48, 0xbf, 0x28,
0x90, 0x74, 0xc3, 0x74, 0x58, 0x5d, 0xb8, 0xce, 0xef, 0x3a, 0x28, 0xd8, 0xce, 0x25, 0x83, 0xf7,
0x2b, 0x6d, 0xdf, 0x4f, 0x86, 0x63, 0xfc, 0xa4, 0x40, 0xd2, 0x7c, 0xcb, 0x7c, 0xae, 0xd8, 0xac,
0x97, 0xaa, 0x8c, 0xa3, 0xd3, 0x82, 0x44, 0x49, 0x7e, 0x1b, 0xa8, 0x86, 0xd2, 0xee, 0x3a, 0x82,
0x46, 0x7b, 0x1c, 0x41, 0x41, 0x77, 0xe3, 0x45, 0xc7, 0xb6, 0x3d, 0xa7, 0xee, 0x76, 0x37, 0x6e,
0xd8, 0xb6, 0x30, 0x42, 0x14, 0x39, 0xa1, 0x3c, 0xab, 0x98, 0xcb, 0x3b, 0xee, 0x4f, 0x08, 0x54,
0x60, 0xf2, 0x9b, 0xf4, 0x1a, 0x99, 0x72, 0xdc, 0x1c, 0x03, 0x27, 0x73, 0x43, 0x60, 0xa6, 0xdd,
0xca, 0x4d, 0x7a, 0x03, 0xc0, 0x13, 0xe8, 0x49, 0x3b, 0xd5, 0xac, 0x3a, 0x73, 0x30, 0x14, 0xc0,
0x4e, 0x40, 0x30, 0xdc, 0x1f, 0x9a, 0x27, 0xa4, 0x6c, 0xdd, 0xbf, 0x6f, 0x95, 0x9a, 0x55, 0xb1,
0x8b, 0x9e, 0x0f, 0x66, 0xf2, 0xa9, 0x86, 0xd2, 0x86, 0x23, 0xc0, 0x16, 0x66, 0xb5, 0xa8, 0x70,
0x4d, 0x2a, 0x47, 0x80, 0x1c, 0xbb, 0xed, 0xb3, 0x76, 0x13, 0xa4, 0xd6, 0x6c, 0x47, 0x38, 0x66,
0x11, 0x0e, 0xa4, 0x29, 0x5f, 0x6b, 0xa0, 0xc2, 0x6b, 0x7a, 0xbf, 0x29, 0xbd, 0x86, 0x5b, 0xef,
0x32, 0x0c, 0x0f, 0xf0, 0x1a, 0xd9, 0x37, 0xe0, 0xaf, 0xb7, 0x2d, 0x55, 0x21, 0x05, 0x9e, 0x0e,
0x6c, 0x4b, 0x90, 0x06, 0xfb, 0x09, 0x71, 0x20, 0x11, 0x99, 0xd9, 0x27, 0x11, 0xb9, 0x48, 0x26,
0x84, 0x55, 0x63, 0x5c, 0x98, 0xb5, 0x06, 0x46, 0x12, 0xa0, 0xeb, 0x10, 0x0d, 0xbf, 0x49, 0xaf,
0x92, 0x49, 0x75, 0x55, 0x33, 0x14, 0x42, 0x1e, 0x96, 0x24, 0xb0, 0xda, 0x81, 0x9e, 0x8c, 0x16,
0x74, 0xca, 0xe3, 0xf0, 0x3c, 0x44, 0x8b, 0x4b, 0x31, 0xf0, 0x97, 0x5e, 0x27, 0x33, 0xf2, 0x66,
0x52, 0xbc, 0xcf, 0x58, 0xb1, 0xc1, 0x1c, 0x99, 0x9e, 0x65, 0x66, 0x01, 0xcd, 0xb1, 0x76, 0x2b,
0x37, 0x25, 0xc7, 0xee, 0x30, 0xb6, 0xc6, 0x9c, 0x15, 0x93, 0x1b, 0xc1, 0xae, 0x54, 0xb5, 0x66,
0xb9, 0xdf, 0x40, 0x64, 0x1e, 0xf3, 0x55, 0xad, 0x59, 0xf0, 0x02, 0xdf, 0xf0, 0x1a, 0x0b, 0x8f,
0xe6, 0xc9, 0x08, 0xc4, 0x36, 0xfd, 0xbe, 0x46, 0x46, 0xdd, 0x02, 0x3b, 0xbd, 0xd2, 0x23, 0x1b,
0x09, 0x57, 0xf8, 0xb3, 0x0b, 0x07, 0x61, 0x71, 0x77, 0x0c, 0xfd, 0xec, 0x7b, 0x7f, 0xfe, 0xd7,
0xf7, 0x86, 0x72, 0xf4, 0x54, 0x41, 0x72, 0x5c, 0x56, 0x3e, 0xfc, 0x50, 0x3f, 0x8e, 0xa0, 0x8f,
0x34, 0x32, 0xa9, 0xd6, 0x44, 0xe9, 0xf5, 0x24, 0x73, 0x45, 0x7f, 0x0e, 0x90, 0xbd, 0xd1, 0x17,
0x2f, 0x02, 0x7e, 0x09, 0x00, 0x3f, 0x4f, 0xaf, 0xc5, 0x00, 0x56, 0xab, 0xb4, 0x85, 0x87, 0xf8,
0xf6, 0x63, 0xaf, 0xf0, 0x10, 0x36, 0xa3, 0x3d, 0xfa, 0xa1, 0x46, 0xa6, 0x55, 0xb9, 0x4b, 0xd5,
0x6a, 0x32, 0x5d, 0xa2, 0x3f, 0x0a, 0x48, 0xa6, 0x4b, 0x4c, 0xa1, 0x5f, 0xbf, 0x08, 0xba, 0x9c,
0xa5, 0x67, 0x12, 0xe8, 0x42, 0xff, 0xa1, 0x91, 0x13, 0x5d, 0xc8, 0xf1, 0x4d, 0x24, 0x5d, 0xea,
0x03, 0x44, 0xf0, 0x25, 0x68, 0x76, 0xf9, 0x30, 0x22, 0x50, 0x9d, 0xeb, 0xa0, 0xce, 0x55, 0xba,
0x90, 0x40, 0x1d, 0xe4, 0xc5, 0x15, 0xda, 0xa3, 0x7f, 0xd7, 0xc8, 0x63, 0x4a, 0x25, 0x55, 0x51,
0xee, 0x95, 0x84, 0xc8, 0x62, 0x8b, 0xe7, 0xd9, 0xa5, 0x43, 0x48, 0x40, 0xd5, 0x6e, 0x82, 0x6a,
0x8b, 0xf4, 0x6a, 0x8c, 0x6a, 0x56, 0x3d, 0x46, 0xb3, 0xa2, 0x55, 0xde, 0xa3, 0xbf, 0xd4, 0xc8,
0xd1, 0xa0, 0x72, 0x89, 0x7d, 0x2e, 0xa2, 0x8c, 0x9d, 0xd8, 0xe7, 0xa2, 0x6a, 0xdc, 0x3d, 0x7d,
0x4e, 0xd1, 0x84, 0xd3, 0x3f, 0x22, 0x70, 0xa5, 0xe0, 0x78, 0x33, 0x61, 0xf0, 0x46, 0x96, 0x5d,
0xb3, 0x2f, 0xf5, 0xc9, 0x8d, 0xe0, 0x5f, 0x00, 0xf0, 0x0b, 0xf4, 0xd9, 0x7d, 0xc0, 0xfb, 0x6c,
0x85, 0x87, 0x5e, 0x7f, 0x8f, 0xfe, 0x45, 0x23, 0x34, 0x5c, 0x88, 0xa6, 0x89, 0xf0, 0xc4, 0x96,
0xbf, 0xb3, 0x2f, 0xf7, 0xcb, 0x8e, 0xfa, 0x2c, 0x81, 0x3e, 0x37, 0xe8, 0x8b, 0xb1, 0xfa, 0x74,
0x7f, 0x44, 0x07, 0xa7, 0xb5, 0xaa, 0xd8, 0x6f, 0x34, 0x72, 0x2c, 0x38, 0x83, 0x74, 0xaf, 0x9b,
0x07, 0x70, 0x91, 0x3e, 0x57, 0x29, 0xb6, 0xe0, 0xad, 0x5f, 0x06, 0xad, 0xe6, 0xe9, 0xd9, 0x44,
0xab, 0x44, 0x3f, 0xd0, 0xc8, 0x54, 0xa0, 0x70, 0x4c, 0x5f, 0x48, 0xe8, 0x25, 0xa1, 0x42, 0x75,
0xf6, 0xc5, 0x3e, 0x38, 0x11, 0x75, 0x1e, 0x50, 0x9f, 0xa7, 0xe7, 0x62, 0x50, 0x57, 0x98, 0x28,
0x0a, 0xce, 0xbd, 0x57, 0x3c, 0xf4, 0x7d, 0x0d, 0xaa, 0xd0, 0xc9, 0x0e, 0xea, 0x40, 0x59, 0x3b,
0xd9, 0x41, 0x1d, 0xac, 0x79, 0xeb, 0x3a, 0xc0, 0x3b, 0x49, 0xb3, 0x31, 0xf0, 0x24, 0x94, 0x9f,
0x69, 0x7e, 0x41, 0x97, 0x2e, 0x26, 0x9c, 0xa4, 0xab, 0xf2, 0x9c, 0x7d, 0xfe, 0xc0, 0x7c, 0x88,
0xb0, 0x00, 0x08, 0x9f, 0xa1, 0xf3, 0x71, 0x06, 0x44, 0x06, 0xe9, 0xbd, 0x65, 0xb6, 0xb3, 0x47,
0x7f, 0xa2, 0x91, 0xb4, 0x27, 0x45, 0x3a, 0xed, 0x62, 0x42, 0xb7, 0xeb, 0x0b, 0x71, 0x44, 0xfd,
0x5b, 0x9f, 0x07, 0xc4, 0x4f, 0xd1, 0x5c, 0x0f, 0xc4, 0xf4, 0x23, 0x8d, 0xcc, 0x74, 0xbf, 0xc0,
0xa5, 0x89, 0xb6, 0xe1, 0x98, 0xb7, 0xc9, 0xd9, 0x9b, 0xfd, 0x31, 0x27, 0x34, 0x75, 0xa9, 0x1b,
0xeb, 0x23, 0x8d, 0xa4, 0x95, 0x77, 0xb4, 0xf4, 0x76, 0x92, 0xe9, 0x7b, 0xbd, 0x0b, 0xce, 0xbe,
0x7a, 0x48, 0x29, 0xa8, 0xcd, 0x05, 0xd0, 0xe6, 0x69, 0xaa, 0xc7, 0xe5, 0xa0, 0x0a, 0xf0, 0x5f,
0x69, 0x81, 0xf2, 0x37, 0x4d, 0x1a, 0xf0, 0xe1, 0x82, 0x7d, 0xf6, 0x7a, 0x3f, 0xac, 0x08, 0x79,
0x01, 0x20, 0x5f, 0xa2, 0x17, 0xe2, 0x16, 0xc0, 0xe7, 0xe9, 0xb8, 0xfb, 0x2f, 0x34, 0x72, 0x54,
0x91, 0x25, 0x3d, 0xfe, 0xc5, 0x84, 0x9e, 0xdb, 0x2f, 0xfa, 0xe8, 0x4f, 0x08, 0x7a, 0x1a, 0x5c,
0x41, 0x4f, 0x7f, 0xad, 0x91, 0x99, 0x40, 0xa5, 0x5a, 0xe2, 0x4e, 0x9a, 0x81, 0x44, 0x7d, 0x09,
0x90, 0xbd, 0xd9, 0x1f, 0x33, 0x62, 0xbf, 0x04, 0xd8, 0xcf, 0xd1, 0xa7, 0xe3, 0x9c, 0x45, 0xe5,
0xa2, 0x7f, 0xd2, 0xc8, 0x6c, 0x54, 0xf1, 0x9e, 0x7e, 0x29, 0xd1, 0x5d, 0x29, 0xfe, 0xab, 0x81,
0xec, 0x2b, 0xfd, 0x0b, 0x40, 0x4d, 0x9e, 0x07, 0x4d, 0xae, 0xd0, 0x42, 0x12, 0x4d, 0xd4, 0x74,
0xf2, 0x63, 0x2d, 0x54, 0xd3, 0xa6, 0x49, 0x13, 0xab, 0xe8, 0x8a, 0x7c, 0xb2, 0x44, 0x26, 0xfe,
0x6b, 0x02, 0x7d, 0x11, 0x74, 0x79, 0x96, 0xe6, 0x63, 0x74, 0xa9, 0x06, 0xf9, 0x3a, 0x31, 0xf1,
0x3b, 0x8d, 0xd0, 0x2e, 0x99, 0xd2, 0xbf, 0x92, 0x26, 0x20, 0x87, 0xd1, 0x26, 0xfe, 0x9b, 0x81,
0x9e, 0xa9, 0x40, 0x97, 0x36, 0xf4, 0x87, 0x1a, 0x19, 0x86, 0x54, 0x26, 0xe9, 0xc1, 0xae, 0x26,
0x5b, 0xcf, 0x1d, 0x88, 0x27, 0x61, 0x16, 0x5f, 0xc2, 0xf4, 0x17, 0x8c, 0xfc, 0x81, 0xdc, 0x33,
0xfd, 0x6f, 0x05, 0x92, 0xef, 0x99, 0xa1, 0xef, 0x0b, 0xfa, 0x03, 0x7b, 0x0d, 0xc0, 0x16, 0xe8,
0xe5, 0x7d, 0xc1, 0x86, 0xae, 0xea, 0x3f, 0xd0, 0xc8, 0x98, 0x97, 0xcf, 0x2e, 0x24, 0xdd, 0xed,
0x0e, 0x6a, 0xd8, 0xae, 0xef, 0x05, 0xf4, 0x33, 0x80, 0xf5, 0x14, 0x7d, 0x72, 0x1f, 0xac, 0xee,
0x4e, 0xee, 0x22, 0xc3, 0x08, 0x4f, 0xbe, 0x93, 0x87, 0x4a, 0xfd, 0xc9, 0x77, 0xf2, 0x70, 0x8d,
0xbe, 0xf7, 0x4e, 0xee, 0xf3, 0xc0, 0x2d, 0x34, 0x58, 0x13, 0x4f, 0x86, 0x3a, 0xb2, 0xca, 0x9e,
0x0c, 0x75, 0x74, 0x09, 0xbe, 0xe7, 0x05, 0xa1, 0x1a, 0x44, 0xf9, 0x63, 0x8d, 0x10, 0xff, 0x7f,
0x65, 0xe8, 0xb5, 0x24, 0x33, 0x87, 0xfe, 0xeb, 0x26, 0xbb, 0x78, 0x50, 0x36, 0x04, 0xfb, 0x0c,
0x80, 0x3d, 0x43, 0x9f, 0x8a, 0x01, 0x2b, 0x3a, 0x2c, 0xcb, 0xaf, 0x7f, 0xfc, 0xe9, 0x9c, 0xf6,
0xc9, 0xa7, 0x73, 0xda, 0x3f, 0x3f, 0x9d, 0xd3, 0xde, 0xff, 0x6c, 0xee, 0xc8, 0x27, 0x9f, 0xcd,
0x1d, 0xf9, 0xeb, 0x67, 0x73, 0x47, 0xee, 0x5d, 0xa9, 0x58, 0x62, 0xab, 0xb9, 0x99, 0x2f, 0xd9,
0x35, 0x55, 0x8c, 0x87, 0xa3, 0xb0, 0x13, 0x90, 0xb8, 0xdb, 0x60, 0x7c, 0x73, 0x14, 0xd2, 0x9e,
0xe7, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x16, 0xbf, 0x39, 0xb6, 0x14, 0x36, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type QueryClient interface {
// Parameters queries the parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Queries a OutTxTracker by index.
OutTxTracker(ctx context.Context, in *QueryGetOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryGetOutTxTrackerResponse, error)
// Queries a list of OutTxTracker items.
OutTxTrackerAll(ctx context.Context, in *QueryAllOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerResponse, error)
OutTxTrackerAllByChain(ctx context.Context, in *QueryAllOutTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerByChainResponse, error)
InTxTrackerAllByChain(ctx context.Context, in *QueryAllInTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackerByChainResponse, error)
InTxTrackerAll(ctx context.Context, in *QueryAllInTxTrackersRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackersResponse, error)
// Queries a InTxHashToCctx by index.
InTxHashToCctx(ctx context.Context, in *QueryGetInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryGetInTxHashToCctxResponse, error)
// Queries a InTxHashToCctx data by index.
InTxHashToCctxData(ctx context.Context, in *QueryInTxHashToCctxDataRequest, opts ...grpc.CallOption) (*QueryInTxHashToCctxDataResponse, error)
// Queries a list of InTxHashToCctx items.
InTxHashToCctxAll(ctx context.Context, in *QueryAllInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryAllInTxHashToCctxResponse, error)
// Queries a list of GetTssAddress items.
GetTssAddress(ctx context.Context, in *QueryGetTssAddressRequest, opts ...grpc.CallOption) (*QueryGetTssAddressResponse, error)
// Queries a tSS by index.
TSS(ctx context.Context, in *QueryGetTSSRequest, opts ...grpc.CallOption) (*QueryGetTSSResponse, error)
// Queries a gasPrice by index.
GasPrice(ctx context.Context, in *QueryGetGasPriceRequest, opts ...grpc.CallOption) (*QueryGetGasPriceResponse, error)
// Queries a list of gasPrice items.
GasPriceAll(ctx context.Context, in *QueryAllGasPriceRequest, opts ...grpc.CallOption) (*QueryAllGasPriceResponse, error)
ConvertGasToZeta(ctx context.Context, in *QueryConvertGasToZetaRequest, opts ...grpc.CallOption) (*QueryConvertGasToZetaResponse, error)
ProtocolFee(ctx context.Context, in *QueryMessagePassingProtocolFeeRequest, opts ...grpc.CallOption) (*QueryMessagePassingProtocolFeeResponse, error)
// Queries a chainNonces by index.
ChainNonces(ctx context.Context, in *QueryGetChainNoncesRequest, opts ...grpc.CallOption) (*QueryGetChainNoncesResponse, error)
// Queries a list of chainNonces items.
ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error)
PendingNoncesAll(ctx context.Context, in *QueryAllPendingNoncesRequest, opts ...grpc.CallOption) (*QueryAllPendingNoncesResponse, error)
PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error)
// Queries a lastBlockHeight by index.
LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error)
// Queries a list of lastBlockHeight items.
LastBlockHeightAll(ctx context.Context, in *QueryAllLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryAllLastBlockHeightResponse, error)
// Queries a send by index.
Cctx(ctx context.Context, in *QueryGetCctxRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error)
// Queries a send by nonce.
CctxByNonce(ctx context.Context, in *QueryGetCctxByNonceRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error)
// Queries a list of send items.
CctxAll(ctx context.Context, in *QueryAllCctxRequest, opts ...grpc.CallOption) (*QueryAllCctxResponse, error)
// Queries a list of send items.
CctxAllPending(ctx context.Context, in *QueryAllCctxPendingRequest, opts ...grpc.CallOption) (*QueryAllCctxPendingResponse, error)
// Queries a list of lastMetaHeight items.
LastZetaHeight(ctx context.Context, in *QueryLastZetaHeightRequest, opts ...grpc.CallOption) (*QueryLastZetaHeightResponse, error)
TssHistory(ctx context.Context, in *QueryTssHistoryRequest, opts ...grpc.CallOption) (*QueryTssHistoryResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) OutTxTracker(ctx context.Context, in *QueryGetOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryGetOutTxTrackerResponse, error) {
out := new(QueryGetOutTxTrackerResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTracker", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) OutTxTrackerAll(ctx context.Context, in *QueryAllOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerResponse, error) {
out := new(QueryAllOutTxTrackerResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTrackerAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) OutTxTrackerAllByChain(ctx context.Context, in *QueryAllOutTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerByChainResponse, error) {
out := new(QueryAllOutTxTrackerByChainResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTrackerAllByChain", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) InTxTrackerAllByChain(ctx context.Context, in *QueryAllInTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackerByChainResponse, error) {
out := new(QueryAllInTxTrackerByChainResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxTrackerAllByChain", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) InTxTrackerAll(ctx context.Context, in *QueryAllInTxTrackersRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackersResponse, error) {
out := new(QueryAllInTxTrackersResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxTrackerAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) InTxHashToCctx(ctx context.Context, in *QueryGetInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryGetInTxHashToCctxResponse, error) {
out := new(QueryGetInTxHashToCctxResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctx", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) InTxHashToCctxData(ctx context.Context, in *QueryInTxHashToCctxDataRequest, opts ...grpc.CallOption) (*QueryInTxHashToCctxDataResponse, error) {
out := new(QueryInTxHashToCctxDataResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctxData", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) InTxHashToCctxAll(ctx context.Context, in *QueryAllInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryAllInTxHashToCctxResponse, error) {
out := new(QueryAllInTxHashToCctxResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctxAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetTssAddress(ctx context.Context, in *QueryGetTssAddressRequest, opts ...grpc.CallOption) (*QueryGetTssAddressResponse, error) {
out := new(QueryGetTssAddressResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GetTssAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) TSS(ctx context.Context, in *QueryGetTSSRequest, opts ...grpc.CallOption) (*QueryGetTSSResponse, error) {
out := new(QueryGetTSSResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/TSS", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GasPrice(ctx context.Context, in *QueryGetGasPriceRequest, opts ...grpc.CallOption) (*QueryGetGasPriceResponse, error) {
out := new(QueryGetGasPriceResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GasPrice", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GasPriceAll(ctx context.Context, in *QueryAllGasPriceRequest, opts ...grpc.CallOption) (*QueryAllGasPriceResponse, error) {
out := new(QueryAllGasPriceResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GasPriceAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ConvertGasToZeta(ctx context.Context, in *QueryConvertGasToZetaRequest, opts ...grpc.CallOption) (*QueryConvertGasToZetaResponse, error) {
out := new(QueryConvertGasToZetaResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ConvertGasToZeta", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ProtocolFee(ctx context.Context, in *QueryMessagePassingProtocolFeeRequest, opts ...grpc.CallOption) (*QueryMessagePassingProtocolFeeResponse, error) {
out := new(QueryMessagePassingProtocolFeeResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ProtocolFee", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ChainNonces(ctx context.Context, in *QueryGetChainNoncesRequest, opts ...grpc.CallOption) (*QueryGetChainNoncesResponse, error) {
out := new(QueryGetChainNoncesResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ChainNonces", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error) {
out := new(QueryAllChainNoncesResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ChainNoncesAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) PendingNoncesAll(ctx context.Context, in *QueryAllPendingNoncesRequest, opts ...grpc.CallOption) (*QueryAllPendingNoncesResponse, error) {
out := new(QueryAllPendingNoncesResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/PendingNoncesAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error) {
out := new(QueryPendingNoncesByChainResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/PendingNoncesByChain", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error) {
out := new(QueryGetLastBlockHeightResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastBlockHeight", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) LastBlockHeightAll(ctx context.Context, in *QueryAllLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryAllLastBlockHeightResponse, error) {
out := new(QueryAllLastBlockHeightResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastBlockHeightAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Cctx(ctx context.Context, in *QueryGetCctxRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) {
out := new(QueryGetCctxResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/Cctx", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) CctxByNonce(ctx context.Context, in *QueryGetCctxByNonceRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) {
out := new(QueryGetCctxResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxByNonce", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) CctxAll(ctx context.Context, in *QueryAllCctxRequest, opts ...grpc.CallOption) (*QueryAllCctxResponse, error) {
out := new(QueryAllCctxResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) CctxAllPending(ctx context.Context, in *QueryAllCctxPendingRequest, opts ...grpc.CallOption) (*QueryAllCctxPendingResponse, error) {
out := new(QueryAllCctxPendingResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxAllPending", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) LastZetaHeight(ctx context.Context, in *QueryLastZetaHeightRequest, opts ...grpc.CallOption) (*QueryLastZetaHeightResponse, error) {
out := new(QueryLastZetaHeightResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastZetaHeight", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) TssHistory(ctx context.Context, in *QueryTssHistoryRequest, opts ...grpc.CallOption) (*QueryTssHistoryResponse, error) {
out := new(QueryTssHistoryResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/TssHistory", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Parameters queries the parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Queries a OutTxTracker by index.
OutTxTracker(context.Context, *QueryGetOutTxTrackerRequest) (*QueryGetOutTxTrackerResponse, error)
// Queries a list of OutTxTracker items.
OutTxTrackerAll(context.Context, *QueryAllOutTxTrackerRequest) (*QueryAllOutTxTrackerResponse, error)
OutTxTrackerAllByChain(context.Context, *QueryAllOutTxTrackerByChainRequest) (*QueryAllOutTxTrackerByChainResponse, error)
InTxTrackerAllByChain(context.Context, *QueryAllInTxTrackerByChainRequest) (*QueryAllInTxTrackerByChainResponse, error)
InTxTrackerAll(context.Context, *QueryAllInTxTrackersRequest) (*QueryAllInTxTrackersResponse, error)
// Queries a InTxHashToCctx by index.
InTxHashToCctx(context.Context, *QueryGetInTxHashToCctxRequest) (*QueryGetInTxHashToCctxResponse, error)
// Queries a InTxHashToCctx data by index.
InTxHashToCctxData(context.Context, *QueryInTxHashToCctxDataRequest) (*QueryInTxHashToCctxDataResponse, error)
// Queries a list of InTxHashToCctx items.
InTxHashToCctxAll(context.Context, *QueryAllInTxHashToCctxRequest) (*QueryAllInTxHashToCctxResponse, error)
// Queries a list of GetTssAddress items.
GetTssAddress(context.Context, *QueryGetTssAddressRequest) (*QueryGetTssAddressResponse, error)
// Queries a tSS by index.
TSS(context.Context, *QueryGetTSSRequest) (*QueryGetTSSResponse, error)
// Queries a gasPrice by index.
GasPrice(context.Context, *QueryGetGasPriceRequest) (*QueryGetGasPriceResponse, error)
// Queries a list of gasPrice items.
GasPriceAll(context.Context, *QueryAllGasPriceRequest) (*QueryAllGasPriceResponse, error)
ConvertGasToZeta(context.Context, *QueryConvertGasToZetaRequest) (*QueryConvertGasToZetaResponse, error)
ProtocolFee(context.Context, *QueryMessagePassingProtocolFeeRequest) (*QueryMessagePassingProtocolFeeResponse, error)
// Queries a chainNonces by index.
ChainNonces(context.Context, *QueryGetChainNoncesRequest) (*QueryGetChainNoncesResponse, error)
// Queries a list of chainNonces items.
ChainNoncesAll(context.Context, *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error)
PendingNoncesAll(context.Context, *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error)
PendingNoncesByChain(context.Context, *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error)
// Queries a lastBlockHeight by index.
LastBlockHeight(context.Context, *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error)
// Queries a list of lastBlockHeight items.
LastBlockHeightAll(context.Context, *QueryAllLastBlockHeightRequest) (*QueryAllLastBlockHeightResponse, error)
// Queries a send by index.
Cctx(context.Context, *QueryGetCctxRequest) (*QueryGetCctxResponse, error)
// Queries a send by nonce.
CctxByNonce(context.Context, *QueryGetCctxByNonceRequest) (*QueryGetCctxResponse, error)
// Queries a list of send items.
CctxAll(context.Context, *QueryAllCctxRequest) (*QueryAllCctxResponse, error)
// Queries a list of send items.
CctxAllPending(context.Context, *QueryAllCctxPendingRequest) (*QueryAllCctxPendingResponse, error)
// Queries a list of lastMetaHeight items.
LastZetaHeight(context.Context, *QueryLastZetaHeightRequest) (*QueryLastZetaHeightResponse, error)
TssHistory(context.Context, *QueryTssHistoryRequest) (*QueryTssHistoryResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) OutTxTracker(ctx context.Context, req *QueryGetOutTxTrackerRequest) (*QueryGetOutTxTrackerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OutTxTracker not implemented")
}
func (*UnimplementedQueryServer) OutTxTrackerAll(ctx context.Context, req *QueryAllOutTxTrackerRequest) (*QueryAllOutTxTrackerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OutTxTrackerAll not implemented")
}
func (*UnimplementedQueryServer) OutTxTrackerAllByChain(ctx context.Context, req *QueryAllOutTxTrackerByChainRequest) (*QueryAllOutTxTrackerByChainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OutTxTrackerAllByChain not implemented")
}
func (*UnimplementedQueryServer) InTxTrackerAllByChain(ctx context.Context, req *QueryAllInTxTrackerByChainRequest) (*QueryAllInTxTrackerByChainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InTxTrackerAllByChain not implemented")
}
func (*UnimplementedQueryServer) InTxTrackerAll(ctx context.Context, req *QueryAllInTxTrackersRequest) (*QueryAllInTxTrackersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InTxTrackerAll not implemented")
}
func (*UnimplementedQueryServer) InTxHashToCctx(ctx context.Context, req *QueryGetInTxHashToCctxRequest) (*QueryGetInTxHashToCctxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctx not implemented")
}
func (*UnimplementedQueryServer) InTxHashToCctxData(ctx context.Context, req *QueryInTxHashToCctxDataRequest) (*QueryInTxHashToCctxDataResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctxData not implemented")
}
func (*UnimplementedQueryServer) InTxHashToCctxAll(ctx context.Context, req *QueryAllInTxHashToCctxRequest) (*QueryAllInTxHashToCctxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctxAll not implemented")
}
func (*UnimplementedQueryServer) GetTssAddress(ctx context.Context, req *QueryGetTssAddressRequest) (*QueryGetTssAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTssAddress not implemented")
}
func (*UnimplementedQueryServer) TSS(ctx context.Context, req *QueryGetTSSRequest) (*QueryGetTSSResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TSS not implemented")
}
func (*UnimplementedQueryServer) GasPrice(ctx context.Context, req *QueryGetGasPriceRequest) (*QueryGetGasPriceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GasPrice not implemented")
}
func (*UnimplementedQueryServer) GasPriceAll(ctx context.Context, req *QueryAllGasPriceRequest) (*QueryAllGasPriceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GasPriceAll not implemented")
}
func (*UnimplementedQueryServer) ConvertGasToZeta(ctx context.Context, req *QueryConvertGasToZetaRequest) (*QueryConvertGasToZetaResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ConvertGasToZeta not implemented")
}
func (*UnimplementedQueryServer) ProtocolFee(ctx context.Context, req *QueryMessagePassingProtocolFeeRequest) (*QueryMessagePassingProtocolFeeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProtocolFee not implemented")
}
func (*UnimplementedQueryServer) ChainNonces(ctx context.Context, req *QueryGetChainNoncesRequest) (*QueryGetChainNoncesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChainNonces not implemented")
}
func (*UnimplementedQueryServer) ChainNoncesAll(ctx context.Context, req *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChainNoncesAll not implemented")
}
func (*UnimplementedQueryServer) PendingNoncesAll(ctx context.Context, req *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesAll not implemented")
}
func (*UnimplementedQueryServer) PendingNoncesByChain(ctx context.Context, req *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesByChain not implemented")
}
func (*UnimplementedQueryServer) LastBlockHeight(ctx context.Context, req *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LastBlockHeight not implemented")
}
func (*UnimplementedQueryServer) LastBlockHeightAll(ctx context.Context, req *QueryAllLastBlockHeightRequest) (*QueryAllLastBlockHeightResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LastBlockHeightAll not implemented")
}
func (*UnimplementedQueryServer) Cctx(ctx context.Context, req *QueryGetCctxRequest) (*QueryGetCctxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Cctx not implemented")
}
func (*UnimplementedQueryServer) CctxByNonce(ctx context.Context, req *QueryGetCctxByNonceRequest) (*QueryGetCctxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CctxByNonce not implemented")
}
func (*UnimplementedQueryServer) CctxAll(ctx context.Context, req *QueryAllCctxRequest) (*QueryAllCctxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CctxAll not implemented")
}
func (*UnimplementedQueryServer) CctxAllPending(ctx context.Context, req *QueryAllCctxPendingRequest) (*QueryAllCctxPendingResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CctxAllPending not implemented")
}
func (*UnimplementedQueryServer) LastZetaHeight(ctx context.Context, req *QueryLastZetaHeightRequest) (*QueryLastZetaHeightResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LastZetaHeight not implemented")
}
func (*UnimplementedQueryServer) TssHistory(ctx context.Context, req *QueryTssHistoryRequest) (*QueryTssHistoryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TssHistory not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_OutTxTracker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetOutTxTrackerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).OutTxTracker(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTracker",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).OutTxTracker(ctx, req.(*QueryGetOutTxTrackerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_OutTxTrackerAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllOutTxTrackerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).OutTxTrackerAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTrackerAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).OutTxTrackerAll(ctx, req.(*QueryAllOutTxTrackerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_OutTxTrackerAllByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllOutTxTrackerByChainRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).OutTxTrackerAllByChain(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTrackerAllByChain",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).OutTxTrackerAllByChain(ctx, req.(*QueryAllOutTxTrackerByChainRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_InTxTrackerAllByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllInTxTrackerByChainRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).InTxTrackerAllByChain(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/InTxTrackerAllByChain",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).InTxTrackerAllByChain(ctx, req.(*QueryAllInTxTrackerByChainRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_InTxTrackerAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllInTxTrackersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).InTxTrackerAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/InTxTrackerAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).InTxTrackerAll(ctx, req.(*QueryAllInTxTrackersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_InTxHashToCctx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetInTxHashToCctxRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).InTxHashToCctx(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctx",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).InTxHashToCctx(ctx, req.(*QueryGetInTxHashToCctxRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_InTxHashToCctxData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryInTxHashToCctxDataRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).InTxHashToCctxData(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctxData",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).InTxHashToCctxData(ctx, req.(*QueryInTxHashToCctxDataRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_InTxHashToCctxAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllInTxHashToCctxRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).InTxHashToCctxAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctxAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).InTxHashToCctxAll(ctx, req.(*QueryAllInTxHashToCctxRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetTssAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetTssAddressRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetTssAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/GetTssAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetTssAddress(ctx, req.(*QueryGetTssAddressRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_TSS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetTSSRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).TSS(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/TSS",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).TSS(ctx, req.(*QueryGetTSSRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GasPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetGasPriceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GasPrice(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/GasPrice",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GasPrice(ctx, req.(*QueryGetGasPriceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GasPriceAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllGasPriceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GasPriceAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/GasPriceAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GasPriceAll(ctx, req.(*QueryAllGasPriceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ConvertGasToZeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryConvertGasToZetaRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ConvertGasToZeta(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/ConvertGasToZeta",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ConvertGasToZeta(ctx, req.(*QueryConvertGasToZetaRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ProtocolFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryMessagePassingProtocolFeeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ProtocolFee(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/ProtocolFee",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ProtocolFee(ctx, req.(*QueryMessagePassingProtocolFeeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ChainNonces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetChainNoncesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ChainNonces(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/ChainNonces",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ChainNonces(ctx, req.(*QueryGetChainNoncesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ChainNoncesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllChainNoncesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ChainNoncesAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/ChainNoncesAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ChainNoncesAll(ctx, req.(*QueryAllChainNoncesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_PendingNoncesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllPendingNoncesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).PendingNoncesAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/PendingNoncesAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).PendingNoncesAll(ctx, req.(*QueryAllPendingNoncesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_PendingNoncesByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryPendingNoncesByChainRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).PendingNoncesByChain(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/PendingNoncesByChain",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).PendingNoncesByChain(ctx, req.(*QueryPendingNoncesByChainRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_LastBlockHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetLastBlockHeightRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).LastBlockHeight(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/LastBlockHeight",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).LastBlockHeight(ctx, req.(*QueryGetLastBlockHeightRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_LastBlockHeightAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllLastBlockHeightRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).LastBlockHeightAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/LastBlockHeightAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).LastBlockHeightAll(ctx, req.(*QueryAllLastBlockHeightRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Cctx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetCctxRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Cctx(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/Cctx",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Cctx(ctx, req.(*QueryGetCctxRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_CctxByNonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetCctxByNonceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).CctxByNonce(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/CctxByNonce",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).CctxByNonce(ctx, req.(*QueryGetCctxByNonceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_CctxAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllCctxRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).CctxAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/CctxAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).CctxAll(ctx, req.(*QueryAllCctxRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_CctxAllPending_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllCctxPendingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).CctxAllPending(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/CctxAllPending",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).CctxAllPending(ctx, req.(*QueryAllCctxPendingRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_LastZetaHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryLastZetaHeightRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).LastZetaHeight(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/LastZetaHeight",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).LastZetaHeight(ctx, req.(*QueryLastZetaHeightRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_TssHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryTssHistoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).TssHistory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Query/TssHistory",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).TssHistory(ctx, req.(*QueryTssHistoryRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.crosschain.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "OutTxTracker",
Handler: _Query_OutTxTracker_Handler,
},
{
MethodName: "OutTxTrackerAll",
Handler: _Query_OutTxTrackerAll_Handler,
},
{
MethodName: "OutTxTrackerAllByChain",
Handler: _Query_OutTxTrackerAllByChain_Handler,
},
{
MethodName: "InTxTrackerAllByChain",
Handler: _Query_InTxTrackerAllByChain_Handler,
},
{
MethodName: "InTxTrackerAll",
Handler: _Query_InTxTrackerAll_Handler,
},
{
MethodName: "InTxHashToCctx",
Handler: _Query_InTxHashToCctx_Handler,
},
{
MethodName: "InTxHashToCctxData",
Handler: _Query_InTxHashToCctxData_Handler,
},
{
MethodName: "InTxHashToCctxAll",
Handler: _Query_InTxHashToCctxAll_Handler,
},
{
MethodName: "GetTssAddress",
Handler: _Query_GetTssAddress_Handler,
},
{
MethodName: "TSS",
Handler: _Query_TSS_Handler,
},
{
MethodName: "GasPrice",
Handler: _Query_GasPrice_Handler,
},
{
MethodName: "GasPriceAll",
Handler: _Query_GasPriceAll_Handler,
},
{
MethodName: "ConvertGasToZeta",
Handler: _Query_ConvertGasToZeta_Handler,
},
{
MethodName: "ProtocolFee",
Handler: _Query_ProtocolFee_Handler,
},
{
MethodName: "ChainNonces",
Handler: _Query_ChainNonces_Handler,
},
{
MethodName: "ChainNoncesAll",
Handler: _Query_ChainNoncesAll_Handler,
},
{
MethodName: "PendingNoncesAll",
Handler: _Query_PendingNoncesAll_Handler,
},
{
MethodName: "PendingNoncesByChain",
Handler: _Query_PendingNoncesByChain_Handler,
},
{
MethodName: "LastBlockHeight",
Handler: _Query_LastBlockHeight_Handler,
},
{
MethodName: "LastBlockHeightAll",
Handler: _Query_LastBlockHeightAll_Handler,
},
{
MethodName: "Cctx",
Handler: _Query_Cctx_Handler,
},
{
MethodName: "CctxByNonce",
Handler: _Query_CctxByNonce_Handler,
},
{
MethodName: "CctxAll",
Handler: _Query_CctxAll_Handler,
},
{
MethodName: "CctxAllPending",
Handler: _Query_CctxAllPending_Handler,
},
{
MethodName: "LastZetaHeight",
Handler: _Query_LastZetaHeight_Handler,
},
{
MethodName: "TssHistory",
Handler: _Query_TssHistory_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "crosschain/query.proto",
}
func (m *QueryTssHistoryRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTssHistoryRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTssHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryTssHistoryResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTssHistoryResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTssHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.TssList) > 0 {
for iNdEx := len(m.TssList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.TssList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryGetOutTxTrackerRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetOutTxTrackerRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Nonce != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x10
}
if m.ChainID != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainID))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryGetOutTxTrackerResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.OutTxTracker.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryAllOutTxTrackerRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllOutTxTrackerRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllOutTxTrackerResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.OutTxTracker) > 0 {
for iNdEx := len(m.OutTxTracker) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.OutTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllOutTxTrackerByChainRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllOutTxTrackerByChainRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllOutTxTrackerByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.Chain != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Chain))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryAllOutTxTrackerByChainResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllOutTxTrackerByChainResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllOutTxTrackerByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.OutTxTracker) > 0 {
for iNdEx := len(m.OutTxTracker) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.OutTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllInTxTrackerByChainRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllInTxTrackerByChainRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllInTxTrackerByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryAllInTxTrackerByChainResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllInTxTrackerByChainResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllInTxTrackerByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.InTxTracker) > 0 {
for iNdEx := len(m.InTxTracker) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.InTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllInTxTrackersRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllInTxTrackersRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllInTxTrackersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryAllInTxTrackersResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllInTxTrackersResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllInTxTrackersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.InTxTracker) > 0 {
for iNdEx := len(m.InTxTracker) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.InTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetInTxHashToCctxRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetInTxHashToCctxRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetInTxHashToCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.InTxHash) > 0 {
i -= len(m.InTxHash)
copy(dAtA[i:], m.InTxHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.InTxHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetInTxHashToCctxResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetInTxHashToCctxResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetInTxHashToCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.InTxHashToCctx.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryInTxHashToCctxDataRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryInTxHashToCctxDataRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryInTxHashToCctxDataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.InTxHash) > 0 {
i -= len(m.InTxHash)
copy(dAtA[i:], m.InTxHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.InTxHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryInTxHashToCctxDataResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryInTxHashToCctxDataResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryInTxHashToCctxDataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.CrossChainTxs) > 0 {
for iNdEx := len(m.CrossChainTxs) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.CrossChainTxs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllInTxHashToCctxRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllInTxHashToCctxRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllInTxHashToCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllInTxHashToCctxResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllInTxHashToCctxResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllInTxHashToCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.InTxHashToCctx) > 0 {
for iNdEx := len(m.InTxHashToCctx) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.InTxHashToCctx[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetTssAddressRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetTssAddressRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetTssAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.TssPubKey) > 0 {
i -= len(m.TssPubKey)
copy(dAtA[i:], m.TssPubKey)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TssPubKey)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetTssAddressResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetTssAddressResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetTssAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Btc) > 0 {
i -= len(m.Btc)
copy(dAtA[i:], m.Btc)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Btc)))
i--
dAtA[i] = 0x12
}
if len(m.Eth) > 0 {
i -= len(m.Eth)
copy(dAtA[i:], m.Eth)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Eth)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetTSSRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetTSSRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetTSSRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryGetTSSResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetTSSResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetTSSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.TSS != nil {
{
size, err := m.TSS.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetGasPriceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetGasPriceRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetGasPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetGasPriceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetGasPriceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.GasPrice != nil {
{
size, err := m.GasPrice.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllGasPriceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllGasPriceRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllGasPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllGasPriceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllGasPriceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.GasPrice) > 0 {
for iNdEx := len(m.GasPrice) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.GasPrice[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetChainNoncesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetChainNoncesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ChainNonces != nil {
{
size, err := m.ChainNonces.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllChainNoncesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllChainNoncesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.ChainNonces) > 0 {
for iNdEx := len(m.ChainNonces) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.ChainNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllPendingNoncesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllPendingNoncesRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllPendingNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryAllPendingNoncesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllPendingNoncesResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllPendingNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.PendingNonces) > 0 {
for iNdEx := len(m.PendingNonces) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.PendingNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryPendingNoncesByChainRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryPendingNoncesByChainRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryPendingNoncesByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryPendingNoncesByChainResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryPendingNoncesByChainResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryPendingNoncesByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.PendingNonces.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryGetLastBlockHeightRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetLastBlockHeightRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetLastBlockHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetLastBlockHeightResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetLastBlockHeightResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetLastBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.LastBlockHeight != nil {
{
size, err := m.LastBlockHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllLastBlockHeightRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllLastBlockHeightRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllLastBlockHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllLastBlockHeightResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllLastBlockHeightResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllLastBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.LastBlockHeight) > 0 {
for iNdEx := len(m.LastBlockHeight) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.LastBlockHeight[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetCctxRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCctxRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetCctxByNonceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCctxByNonceRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCctxByNonceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Nonce != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x10
}
if m.ChainID != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainID))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryGetCctxResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCctxResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.CrossChainTx != nil {
{
size, err := m.CrossChainTx.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllCctxRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllCctxRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllCctxResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllCctxResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.CrossChainTx) > 0 {
for iNdEx := len(m.CrossChainTx) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.CrossChainTx[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllCctxPendingRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllCctxPendingRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllCctxPendingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryAllCctxPendingResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllCctxPendingResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllCctxPendingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.CrossChainTx) > 0 {
for iNdEx := len(m.CrossChainTx) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.CrossChainTx[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryLastZetaHeightRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryLastZetaHeightRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryLastZetaHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryLastZetaHeightResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryLastZetaHeightResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryLastZetaHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryConvertGasToZetaRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryConvertGasToZetaRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryConvertGasToZetaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.GasLimit) > 0 {
i -= len(m.GasLimit)
copy(dAtA[i:], m.GasLimit)
i = encodeVarintQuery(dAtA, i, uint64(len(m.GasLimit)))
i--
dAtA[i] = 0x12
}
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryConvertGasToZetaResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryConvertGasToZetaResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryConvertGasToZetaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ZetaBlockHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ZetaBlockHeight))
i--
dAtA[i] = 0x18
}
if len(m.ProtocolFeeInZeta) > 0 {
i -= len(m.ProtocolFeeInZeta)
copy(dAtA[i:], m.ProtocolFeeInZeta)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ProtocolFeeInZeta)))
i--
dAtA[i] = 0x12
}
if len(m.OutboundGasInZeta) > 0 {
i -= len(m.OutboundGasInZeta)
copy(dAtA[i:], m.OutboundGasInZeta)
i = encodeVarintQuery(dAtA, i, uint64(len(m.OutboundGasInZeta)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryMessagePassingProtocolFeeRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryMessagePassingProtocolFeeRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryMessagePassingProtocolFeeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryMessagePassingProtocolFeeResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryMessagePassingProtocolFeeResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryMessagePassingProtocolFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.FeeInZeta) > 0 {
i -= len(m.FeeInZeta)
copy(dAtA[i:], m.FeeInZeta)
i = encodeVarintQuery(dAtA, i, uint64(len(m.FeeInZeta)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryZEVMGetTransactionReceiptRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryZEVMGetTransactionReceiptRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryZEVMGetTransactionReceiptRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Hash) > 0 {
i -= len(m.Hash)
copy(dAtA[i:], m.Hash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryZEVMGetTransactionReceiptResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryZEVMGetTransactionReceiptResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryZEVMGetTransactionReceiptResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Logs) > 0 {
for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x62
}
}
if len(m.TransactionIndex) > 0 {
i -= len(m.TransactionIndex)
copy(dAtA[i:], m.TransactionIndex)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionIndex)))
i--
dAtA[i] = 0x5a
}
if len(m.TransactionHash) > 0 {
i -= len(m.TransactionHash)
copy(dAtA[i:], m.TransactionHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionHash)))
i--
dAtA[i] = 0x52
}
if len(m.To) > 0 {
i -= len(m.To)
copy(dAtA[i:], m.To)
i = encodeVarintQuery(dAtA, i, uint64(len(m.To)))
i--
dAtA[i] = 0x4a
}
if len(m.Status) > 0 {
i -= len(m.Status)
copy(dAtA[i:], m.Status)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Status)))
i--
dAtA[i] = 0x42
}
if len(m.LogsBloom) > 0 {
i -= len(m.LogsBloom)
copy(dAtA[i:], m.LogsBloom)
i = encodeVarintQuery(dAtA, i, uint64(len(m.LogsBloom)))
i--
dAtA[i] = 0x3a
}
if len(m.GasUsed) > 0 {
i -= len(m.GasUsed)
copy(dAtA[i:], m.GasUsed)
i = encodeVarintQuery(dAtA, i, uint64(len(m.GasUsed)))
i--
dAtA[i] = 0x32
}
if len(m.From) > 0 {
i -= len(m.From)
copy(dAtA[i:], m.From)
i = encodeVarintQuery(dAtA, i, uint64(len(m.From)))
i--
dAtA[i] = 0x2a
}
if len(m.CumulativeGasUsed) > 0 {
i -= len(m.CumulativeGasUsed)
copy(dAtA[i:], m.CumulativeGasUsed)
i = encodeVarintQuery(dAtA, i, uint64(len(m.CumulativeGasUsed)))
i--
dAtA[i] = 0x22
}
if len(m.ContractAddress) > 0 {
i -= len(m.ContractAddress)
copy(dAtA[i:], m.ContractAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress)))
i--
dAtA[i] = 0x1a
}
if len(m.BlockNumber) > 0 {
i -= len(m.BlockNumber)
copy(dAtA[i:], m.BlockNumber)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockNumber)))
i--
dAtA[i] = 0x12
}
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Log) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Log) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Removed {
i--
if m.Removed {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x48
}
if m.LogIndex != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.LogIndex))
i--
dAtA[i] = 0x40
}
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0x3a
}
if m.TransactionIndex != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.TransactionIndex))
i--
dAtA[i] = 0x30
}
if len(m.TransactionHash) > 0 {
i -= len(m.TransactionHash)
copy(dAtA[i:], m.TransactionHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionHash)))
i--
dAtA[i] = 0x2a
}
if m.BlockNumber != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.BlockNumber))
i--
dAtA[i] = 0x20
}
if len(m.Data) > 0 {
i -= len(m.Data)
copy(dAtA[i:], m.Data)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Data)))
i--
dAtA[i] = 0x1a
}
if len(m.Topics) > 0 {
for iNdEx := len(m.Topics) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Topics[iNdEx])
copy(dAtA[i:], m.Topics[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.Topics[iNdEx])))
i--
dAtA[i] = 0x12
}
}
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryZEVMGetTransactionRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryZEVMGetTransactionRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryZEVMGetTransactionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Hash) > 0 {
i -= len(m.Hash)
copy(dAtA[i:], m.Hash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryZEVMGetTransactionResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryZEVMGetTransactionResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryZEVMGetTransactionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.S) > 0 {
i -= len(m.S)
copy(dAtA[i:], m.S)
i = encodeVarintQuery(dAtA, i, uint64(len(m.S)))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x8a
}
if len(m.R) > 0 {
i -= len(m.R)
copy(dAtA[i:], m.R)
i = encodeVarintQuery(dAtA, i, uint64(len(m.R)))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x82
}
if len(m.V) > 0 {
i -= len(m.V)
copy(dAtA[i:], m.V)
i = encodeVarintQuery(dAtA, i, uint64(len(m.V)))
i--
dAtA[i] = 0x7a
}
if len(m.ChainId) > 0 {
i -= len(m.ChainId)
copy(dAtA[i:], m.ChainId)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId)))
i--
dAtA[i] = 0x72
}
if len(m.AccessList) > 0 {
for iNdEx := len(m.AccessList) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.AccessList[iNdEx])
copy(dAtA[i:], m.AccessList[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.AccessList[iNdEx])))
i--
dAtA[i] = 0x6a
}
}
if len(m.Type) > 0 {
i -= len(m.Type)
copy(dAtA[i:], m.Type)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Type)))
i--
dAtA[i] = 0x62
}
if len(m.Value) > 0 {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0x5a
}
if len(m.TransactionIndex) > 0 {
i -= len(m.TransactionIndex)
copy(dAtA[i:], m.TransactionIndex)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionIndex)))
i--
dAtA[i] = 0x52
}
if len(m.To) > 0 {
i -= len(m.To)
copy(dAtA[i:], m.To)
i = encodeVarintQuery(dAtA, i, uint64(len(m.To)))
i--
dAtA[i] = 0x4a
}
if len(m.Nonce) > 0 {
i -= len(m.Nonce)
copy(dAtA[i:], m.Nonce)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Nonce)))
i--
dAtA[i] = 0x42
}
if len(m.Input) > 0 {
i -= len(m.Input)
copy(dAtA[i:], m.Input)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Input)))
i--
dAtA[i] = 0x3a
}
if len(m.Hash) > 0 {
i -= len(m.Hash)
copy(dAtA[i:], m.Hash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash)))
i--
dAtA[i] = 0x32
}
if len(m.GasPrice) > 0 {
i -= len(m.GasPrice)
copy(dAtA[i:], m.GasPrice)
i = encodeVarintQuery(dAtA, i, uint64(len(m.GasPrice)))
i--
dAtA[i] = 0x2a
}
if len(m.Gas) > 0 {
i -= len(m.Gas)
copy(dAtA[i:], m.Gas)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Gas)))
i--
dAtA[i] = 0x22
}
if len(m.From) > 0 {
i -= len(m.From)
copy(dAtA[i:], m.From)
i = encodeVarintQuery(dAtA, i, uint64(len(m.From)))
i--
dAtA[i] = 0x1a
}
if len(m.BlockNumber) > 0 {
i -= len(m.BlockNumber)
copy(dAtA[i:], m.BlockNumber)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockNumber)))
i--
dAtA[i] = 0x12
}
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryZEVMGetBlockByNumberRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryZEVMGetBlockByNumberRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryZEVMGetBlockByNumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryZEVMGetBlockByNumberResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryZEVMGetBlockByNumberResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryZEVMGetBlockByNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.MixHash) > 0 {
i -= len(m.MixHash)
copy(dAtA[i:], m.MixHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.MixHash)))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0xaa
}
if len(m.BaseFeePerGas) > 0 {
i -= len(m.BaseFeePerGas)
copy(dAtA[i:], m.BaseFeePerGas)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseFeePerGas)))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0xa2
}
if len(m.Uncles) > 0 {
for iNdEx := len(m.Uncles) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Uncles[iNdEx])
copy(dAtA[i:], m.Uncles[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.Uncles[iNdEx])))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x9a
}
}
if len(m.Transactions) > 0 {
for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Transactions[iNdEx])
copy(dAtA[i:], m.Transactions[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.Transactions[iNdEx])))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x92
}
}
if len(m.Timestamp) > 0 {
i -= len(m.Timestamp)
copy(dAtA[i:], m.Timestamp)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Timestamp)))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x8a
}
if len(m.GasUsed) > 0 {
i -= len(m.GasUsed)
copy(dAtA[i:], m.GasUsed)
i = encodeVarintQuery(dAtA, i, uint64(len(m.GasUsed)))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x82
}
if len(m.GasLimit) > 0 {
i -= len(m.GasLimit)
copy(dAtA[i:], m.GasLimit)
i = encodeVarintQuery(dAtA, i, uint64(len(m.GasLimit)))
i--
dAtA[i] = 0x7a
}
if len(m.Size_) > 0 {
i -= len(m.Size_)
copy(dAtA[i:], m.Size_)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Size_)))
i--
dAtA[i] = 0x72
}
if len(m.ExtraData) > 0 {
i -= len(m.ExtraData)
copy(dAtA[i:], m.ExtraData)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ExtraData)))
i--
dAtA[i] = 0x6a
}
if len(m.TotalDifficulty) > 0 {
i -= len(m.TotalDifficulty)
copy(dAtA[i:], m.TotalDifficulty)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TotalDifficulty)))
i--
dAtA[i] = 0x62
}
if len(m.Difficulty) > 0 {
i -= len(m.Difficulty)
copy(dAtA[i:], m.Difficulty)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Difficulty)))
i--
dAtA[i] = 0x5a
}
if len(m.Miner) > 0 {
i -= len(m.Miner)
copy(dAtA[i:], m.Miner)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Miner)))
i--
dAtA[i] = 0x52
}
if len(m.ReceiptsRoot) > 0 {
i -= len(m.ReceiptsRoot)
copy(dAtA[i:], m.ReceiptsRoot)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ReceiptsRoot)))
i--
dAtA[i] = 0x4a
}
if len(m.StateRoot) > 0 {
i -= len(m.StateRoot)
copy(dAtA[i:], m.StateRoot)
i = encodeVarintQuery(dAtA, i, uint64(len(m.StateRoot)))
i--
dAtA[i] = 0x42
}
if len(m.TransactionsRoot) > 0 {
i -= len(m.TransactionsRoot)
copy(dAtA[i:], m.TransactionsRoot)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionsRoot)))
i--
dAtA[i] = 0x3a
}
if len(m.LogsBloom) > 0 {
i -= len(m.LogsBloom)
copy(dAtA[i:], m.LogsBloom)
i = encodeVarintQuery(dAtA, i, uint64(len(m.LogsBloom)))
i--
dAtA[i] = 0x32
}
if len(m.Sha3Uncles) > 0 {
i -= len(m.Sha3Uncles)
copy(dAtA[i:], m.Sha3Uncles)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Sha3Uncles)))
i--
dAtA[i] = 0x2a
}
if len(m.Nonce) > 0 {
i -= len(m.Nonce)
copy(dAtA[i:], m.Nonce)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Nonce)))
i--
dAtA[i] = 0x22
}
if len(m.ParentHash) > 0 {
i -= len(m.ParentHash)
copy(dAtA[i:], m.ParentHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ParentHash)))
i--
dAtA[i] = 0x1a
}
if len(m.Hash) > 0 {
i -= len(m.Hash)
copy(dAtA[i:], m.Hash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash)))
i--
dAtA[i] = 0x12
}
if len(m.Number) > 0 {
i -= len(m.Number)
copy(dAtA[i:], m.Number)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Number)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *QueryTssHistoryRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryTssHistoryResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.TssList) > 0 {
for _, e := range m.TssList {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryGetOutTxTrackerRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainID != 0 {
n += 1 + sovQuery(uint64(m.ChainID))
}
if m.Nonce != 0 {
n += 1 + sovQuery(uint64(m.Nonce))
}
return n
}
func (m *QueryGetOutTxTrackerResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.OutTxTracker.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryAllOutTxTrackerRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllOutTxTrackerResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.OutTxTracker) > 0 {
for _, e := range m.OutTxTracker {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllOutTxTrackerByChainRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Chain != 0 {
n += 1 + sovQuery(uint64(m.Chain))
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllOutTxTrackerByChainResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.OutTxTracker) > 0 {
for _, e := range m.OutTxTracker {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllInTxTrackerByChainRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllInTxTrackerByChainResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.InTxTracker) > 0 {
for _, e := range m.InTxTracker {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllInTxTrackersRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryAllInTxTrackersResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.InTxTracker) > 0 {
for _, e := range m.InTxTracker {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryGetInTxHashToCctxRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.InTxHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetInTxHashToCctxResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.InTxHashToCctx.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryInTxHashToCctxDataRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.InTxHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryInTxHashToCctxDataResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.CrossChainTxs) > 0 {
for _, e := range m.CrossChainTxs {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryAllInTxHashToCctxRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllInTxHashToCctxResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.InTxHashToCctx) > 0 {
for _, e := range m.InTxHashToCctx {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetTssAddressRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.TssPubKey)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetTssAddressResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Eth)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Btc)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetTSSRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryGetTSSResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.TSS != nil {
l = m.TSS.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetGasPriceRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetGasPriceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.GasPrice != nil {
l = m.GasPrice.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllGasPriceRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllGasPriceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.GasPrice) > 0 {
for _, e := range m.GasPrice {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetChainNoncesRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetChainNoncesResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainNonces != nil {
l = m.ChainNonces.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllChainNoncesRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllChainNoncesResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.ChainNonces) > 0 {
for _, e := range m.ChainNonces {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllPendingNoncesRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryAllPendingNoncesResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.PendingNonces) > 0 {
for _, e := range m.PendingNonces {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryPendingNoncesByChainRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
return n
}
func (m *QueryPendingNoncesByChainResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.PendingNonces.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryGetLastBlockHeightRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetLastBlockHeightResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.LastBlockHeight != nil {
l = m.LastBlockHeight.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllLastBlockHeightRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllLastBlockHeightResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.LastBlockHeight) > 0 {
for _, e := range m.LastBlockHeight {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetCctxRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetCctxByNonceRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainID != 0 {
n += 1 + sovQuery(uint64(m.ChainID))
}
if m.Nonce != 0 {
n += 1 + sovQuery(uint64(m.Nonce))
}
return n
}
func (m *QueryGetCctxResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.CrossChainTx != nil {
l = m.CrossChainTx.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllCctxRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllCctxResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.CrossChainTx) > 0 {
for _, e := range m.CrossChainTx {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllCctxPendingRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllCctxPendingResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.CrossChainTx) > 0 {
for _, e := range m.CrossChainTx {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryLastZetaHeightRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryLastZetaHeightResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
return n
}
func (m *QueryConvertGasToZetaRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
l = len(m.GasLimit)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryConvertGasToZetaResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.OutboundGasInZeta)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ProtocolFeeInZeta)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ZetaBlockHeight != 0 {
n += 1 + sovQuery(uint64(m.ZetaBlockHeight))
}
return n
}
func (m *QueryMessagePassingProtocolFeeRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryMessagePassingProtocolFeeResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.FeeInZeta)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryZEVMGetTransactionReceiptRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Hash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryZEVMGetTransactionReceiptResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.BlockNumber)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ContractAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.CumulativeGasUsed)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.From)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.GasUsed)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.LogsBloom)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Status)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.To)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.TransactionHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.TransactionIndex)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if len(m.Logs) > 0 {
for _, e := range m.Logs {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *Log) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if len(m.Topics) > 0 {
for _, s := range m.Topics {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
l = len(m.Data)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.BlockNumber != 0 {
n += 1 + sovQuery(uint64(m.BlockNumber))
}
l = len(m.TransactionHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.TransactionIndex != 0 {
n += 1 + sovQuery(uint64(m.TransactionIndex))
}
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.LogIndex != 0 {
n += 1 + sovQuery(uint64(m.LogIndex))
}
if m.Removed {
n += 2
}
return n
}
func (m *QueryZEVMGetTransactionRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Hash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryZEVMGetTransactionResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.BlockNumber)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.From)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Gas)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.GasPrice)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Hash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Input)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Nonce)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.To)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.TransactionIndex)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Value)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Type)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if len(m.AccessList) > 0 {
for _, s := range m.AccessList {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
l = len(m.ChainId)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.V)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.R)
if l > 0 {
n += 2 + l + sovQuery(uint64(l))
}
l = len(m.S)
if l > 0 {
n += 2 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryZEVMGetBlockByNumberRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
return n
}
func (m *QueryZEVMGetBlockByNumberResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Number)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Hash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ParentHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Nonce)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Sha3Uncles)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.LogsBloom)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.TransactionsRoot)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.StateRoot)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ReceiptsRoot)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Miner)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Difficulty)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.TotalDifficulty)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ExtraData)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Size_)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.GasLimit)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.GasUsed)
if l > 0 {
n += 2 + l + sovQuery(uint64(l))
}
l = len(m.Timestamp)
if l > 0 {
n += 2 + l + sovQuery(uint64(l))
}
if len(m.Transactions) > 0 {
for _, s := range m.Transactions {
l = len(s)
n += 2 + l + sovQuery(uint64(l))
}
}
if len(m.Uncles) > 0 {
for _, s := range m.Uncles {
l = len(s)
n += 2 + l + sovQuery(uint64(l))
}
}
l = len(m.BaseFeePerGas)
if l > 0 {
n += 2 + l + sovQuery(uint64(l))
}
l = len(m.MixHash)
if l > 0 {
n += 2 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *QueryTssHistoryRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTssHistoryRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTssHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryTssHistoryResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTssHistoryResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTssHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssList = append(m.TssList, TSS{})
if err := m.TssList[len(m.TssList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetOutTxTrackerRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetOutTxTrackerRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetOutTxTrackerRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType)
}
m.ChainID = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainID |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetOutTxTrackerResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetOutTxTrackerResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.OutTxTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllOutTxTrackerRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllOutTxTrackerRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllOutTxTrackerRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllOutTxTrackerResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllOutTxTrackerResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutTxTracker = append(m.OutTxTracker, OutTxTracker{})
if err := m.OutTxTracker[len(m.OutTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllOutTxTrackerByChainRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllOutTxTrackerByChainRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllOutTxTrackerByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType)
}
m.Chain = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Chain |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllOutTxTrackerByChainResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllOutTxTrackerByChainResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllOutTxTrackerByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutTxTracker = append(m.OutTxTracker, OutTxTracker{})
if err := m.OutTxTracker[len(m.OutTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllInTxTrackerByChainRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllInTxTrackerByChainRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllInTxTrackerByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllInTxTrackerByChainResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllInTxTrackerByChainResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllInTxTrackerByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxTracker", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxTracker = append(m.InTxTracker, InTxTracker{})
if err := m.InTxTracker[len(m.InTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllInTxTrackersRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllInTxTrackersRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllInTxTrackersRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllInTxTrackersResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllInTxTrackersResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllInTxTrackersResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxTracker", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxTracker = append(m.InTxTracker, InTxTracker{})
if err := m.InTxTracker[len(m.InTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetInTxHashToCctxRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetInTxHashToCctxRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetInTxHashToCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetInTxHashToCctxResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetInTxHashToCctxResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetInTxHashToCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctx", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.InTxHashToCctx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryInTxHashToCctxDataRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryInTxHashToCctxDataRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryInTxHashToCctxDataRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryInTxHashToCctxDataResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryInTxHashToCctxDataResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryInTxHashToCctxDataResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTxs", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CrossChainTxs = append(m.CrossChainTxs, CrossChainTx{})
if err := m.CrossChainTxs[len(m.CrossChainTxs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllInTxHashToCctxRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllInTxHashToCctxRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllInTxHashToCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllInTxHashToCctxResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllInTxHashToCctxResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllInTxHashToCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctx", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHashToCctx = append(m.InTxHashToCctx, InTxHashToCctx{})
if err := m.InTxHashToCctx[len(m.InTxHashToCctx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetTssAddressRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetTssAddressRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetTssAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssPubKey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssPubKey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetTssAddressResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetTssAddressResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetTssAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Eth", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Eth = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Btc", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Btc = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetTSSRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetTSSRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetTSSRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetTSSResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetTSSResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetTSSResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TSS", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.TSS == nil {
m.TSS = &TSS{}
}
if err := m.TSS.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetGasPriceRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetGasPriceRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetGasPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetGasPriceResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetGasPriceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetGasPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.GasPrice == nil {
m.GasPrice = &GasPrice{}
}
if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllGasPriceRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllGasPriceRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllGasPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllGasPriceResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllGasPriceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllGasPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GasPrice = append(m.GasPrice, &GasPrice{})
if err := m.GasPrice[len(m.GasPrice)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetChainNoncesRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetChainNoncesRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetChainNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetChainNoncesResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetChainNoncesResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainNonces", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ChainNonces == nil {
m.ChainNonces = &ChainNonces{}
}
if err := m.ChainNonces.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllChainNoncesRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllChainNoncesRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllChainNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllChainNoncesResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllChainNoncesResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainNonces", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainNonces = append(m.ChainNonces, &ChainNonces{})
if err := m.ChainNonces[len(m.ChainNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllPendingNoncesRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllPendingNoncesRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllPendingNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllPendingNoncesResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllPendingNoncesResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllPendingNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PendingNonces = append(m.PendingNonces, &PendingNonces{})
if err := m.PendingNonces[len(m.PendingNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryPendingNoncesByChainRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryPendingNoncesByChainResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.PendingNonces.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetLastBlockHeightRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetLastBlockHeightRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetLastBlockHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetLastBlockHeightResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetLastBlockHeightResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetLastBlockHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeight", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.LastBlockHeight == nil {
m.LastBlockHeight = &LastBlockHeight{}
}
if err := m.LastBlockHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllLastBlockHeightRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllLastBlockHeightRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllLastBlockHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllLastBlockHeightResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllLastBlockHeightResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllLastBlockHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeight", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LastBlockHeight = append(m.LastBlockHeight, &LastBlockHeight{})
if err := m.LastBlockHeight[len(m.LastBlockHeight)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCctxRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCctxRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCctxByNonceRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCctxByNonceRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCctxByNonceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType)
}
m.ChainID = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainID |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCctxResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCctxResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.CrossChainTx == nil {
m.CrossChainTx = &CrossChainTx{}
}
if err := m.CrossChainTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllCctxRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllCctxRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllCctxResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllCctxResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CrossChainTx = append(m.CrossChainTx, &CrossChainTx{})
if err := m.CrossChainTx[len(m.CrossChainTx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllCctxPendingRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllCctxPendingRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllCctxPendingRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllCctxPendingResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllCctxPendingResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllCctxPendingResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CrossChainTx = append(m.CrossChainTx, &CrossChainTx{})
if err := m.CrossChainTx[len(m.CrossChainTx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryLastZetaHeightRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryLastZetaHeightRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryLastZetaHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryLastZetaHeightResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryLastZetaHeightResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryLastZetaHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryConvertGasToZetaRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryConvertGasToZetaRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryConvertGasToZetaRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GasLimit = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryConvertGasToZetaResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryConvertGasToZetaResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryConvertGasToZetaResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundGasInZeta", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OutboundGasInZeta = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProtocolFeeInZeta", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProtocolFeeInZeta = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ZetaBlockHeight", wireType)
}
m.ZetaBlockHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ZetaBlockHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryMessagePassingProtocolFeeRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryMessagePassingProtocolFeeRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryMessagePassingProtocolFeeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryMessagePassingProtocolFeeResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryMessagePassingProtocolFeeResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryMessagePassingProtocolFeeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FeeInZeta", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FeeInZeta = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryZEVMGetTransactionReceiptRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Hash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockNumber = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CumulativeGasUsed", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CumulativeGasUsed = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field From", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.From = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GasUsed = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LogsBloom", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LogsBloom = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Status = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field To", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.To = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TransactionHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TransactionHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TransactionIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TransactionIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Logs = append(m.Logs, &Log{})
if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Log) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Log: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Topics", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Topics = append(m.Topics, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Data = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType)
}
m.BlockNumber = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BlockNumber |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TransactionHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TransactionHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TransactionIndex", wireType)
}
m.TransactionIndex = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.TransactionIndex |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LogIndex", wireType)
}
m.LogIndex = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LogIndex |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Removed", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Removed = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryZEVMGetTransactionRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryZEVMGetTransactionRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryZEVMGetTransactionRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Hash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryZEVMGetTransactionResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryZEVMGetTransactionResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockNumber = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field From", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.From = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Gas", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Gas = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GasPrice = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Hash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Input = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Nonce = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field To", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.To = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TransactionIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TransactionIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Value = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Type = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AccessList", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AccessList = append(m.AccessList, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 14:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 15:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field V", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.V = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 16:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field R", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.R = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 17:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field S", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.S = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryZEVMGetBlockByNumberRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryZEVMGetBlockByNumberRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryZEVMGetBlockByNumberRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryZEVMGetBlockByNumberResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryZEVMGetBlockByNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Number = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Hash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ParentHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Nonce = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sha3Uncles", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Sha3Uncles = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LogsBloom", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LogsBloom = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TransactionsRoot", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TransactionsRoot = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.StateRoot = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ReceiptsRoot", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ReceiptsRoot = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Miner", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Miner = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Difficulty", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Difficulty = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TotalDifficulty", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TotalDifficulty = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExtraData", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ExtraData = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 14:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Size_ = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 15:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GasLimit = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 16:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GasUsed = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 17:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Timestamp = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 18:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Transactions = append(m.Transactions, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 19:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Uncles", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Uncles = append(m.Uncles, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 20:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BaseFeePerGas", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BaseFeePerGas = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 21:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MixHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MixHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthQuery
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupQuery
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthQuery
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: crosschain/query.proto
/*
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package types
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := server.Params(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_OutTxTracker_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetOutTxTrackerRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chainID"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chainID")
}
protoReq.ChainID, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chainID", err)
}
val, ok = pathParams["nonce"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonce")
}
protoReq.Nonce, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonce", err)
}
msg, err := client.OutTxTracker(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_OutTxTracker_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetOutTxTrackerRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chainID"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chainID")
}
protoReq.ChainID, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chainID", err)
}
val, ok = pathParams["nonce"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonce")
}
protoReq.Nonce, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonce", err)
}
msg, err := server.OutTxTracker(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_OutTxTrackerAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_OutTxTrackerAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllOutTxTrackerRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OutTxTrackerAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.OutTxTrackerAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_OutTxTrackerAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllOutTxTrackerRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OutTxTrackerAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.OutTxTrackerAll(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_OutTxTrackerAllByChain_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_OutTxTrackerAllByChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllOutTxTrackerByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain")
}
protoReq.Chain, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OutTxTrackerAllByChain_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.OutTxTrackerAllByChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_OutTxTrackerAllByChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllOutTxTrackerByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain")
}
protoReq.Chain, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OutTxTrackerAllByChain_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.OutTxTrackerAllByChain(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_InTxTrackerAllByChain_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_InTxTrackerAllByChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllInTxTrackerByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InTxTrackerAllByChain_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.InTxTrackerAllByChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_InTxTrackerAllByChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllInTxTrackerByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InTxTrackerAllByChain_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.InTxTrackerAllByChain(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_InTxTrackerAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllInTxTrackersRequest
var metadata runtime.ServerMetadata
msg, err := client.InTxTrackerAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_InTxTrackerAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllInTxTrackersRequest
var metadata runtime.ServerMetadata
msg, err := server.InTxTrackerAll(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_InTxHashToCctx_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetInTxHashToCctxRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["inTxHash"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "inTxHash")
}
protoReq.InTxHash, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "inTxHash", err)
}
msg, err := client.InTxHashToCctx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_InTxHashToCctx_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetInTxHashToCctxRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["inTxHash"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "inTxHash")
}
protoReq.InTxHash, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "inTxHash", err)
}
msg, err := server.InTxHashToCctx(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_InTxHashToCctxData_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryInTxHashToCctxDataRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["inTxHash"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "inTxHash")
}
protoReq.InTxHash, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "inTxHash", err)
}
msg, err := client.InTxHashToCctxData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_InTxHashToCctxData_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryInTxHashToCctxDataRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["inTxHash"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "inTxHash")
}
protoReq.InTxHash, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "inTxHash", err)
}
msg, err := server.InTxHashToCctxData(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_InTxHashToCctxAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_InTxHashToCctxAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllInTxHashToCctxRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InTxHashToCctxAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.InTxHashToCctxAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_InTxHashToCctxAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllInTxHashToCctxRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InTxHashToCctxAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.InTxHashToCctxAll(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_GetTssAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_GetTssAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetTssAddressRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetTssAddress_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetTssAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetTssAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetTssAddressRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetTssAddress_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetTssAddress(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_TSS_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetTSSRequest
var metadata runtime.ServerMetadata
msg, err := client.TSS(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_TSS_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetTSSRequest
var metadata runtime.ServerMetadata
msg, err := server.TSS(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GasPrice_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetGasPriceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := client.GasPrice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GasPrice_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetGasPriceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := server.GasPrice(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_GasPriceAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_GasPriceAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllGasPriceRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GasPriceAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GasPriceAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GasPriceAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllGasPriceRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GasPriceAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GasPriceAll(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_ConvertGasToZeta_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_ConvertGasToZeta_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryConvertGasToZetaRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConvertGasToZeta_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ConvertGasToZeta(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ConvertGasToZeta_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryConvertGasToZetaRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConvertGasToZeta_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ConvertGasToZeta(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_ProtocolFee_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryMessagePassingProtocolFeeRequest
var metadata runtime.ServerMetadata
msg, err := client.ProtocolFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ProtocolFee_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryMessagePassingProtocolFeeRequest
var metadata runtime.ServerMetadata
msg, err := server.ProtocolFee(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_ChainNonces_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetChainNoncesRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := client.ChainNonces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ChainNonces_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetChainNoncesRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := server.ChainNonces(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_ChainNoncesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllChainNoncesRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainNoncesAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ChainNoncesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllChainNoncesRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainNoncesAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ChainNoncesAll(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_PendingNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllPendingNoncesRequest
var metadata runtime.ServerMetadata
msg, err := client.PendingNoncesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_PendingNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllPendingNoncesRequest
var metadata runtime.ServerMetadata
msg, err := server.PendingNoncesAll(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryPendingNoncesByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
msg, err := client.PendingNoncesByChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryPendingNoncesByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
msg, err := server.PendingNoncesByChain(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_LastBlockHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetLastBlockHeightRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := client.LastBlockHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_LastBlockHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetLastBlockHeightRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := server.LastBlockHeight(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_LastBlockHeightAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_LastBlockHeightAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllLastBlockHeightRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LastBlockHeightAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.LastBlockHeightAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_LastBlockHeightAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllLastBlockHeightRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LastBlockHeightAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.LastBlockHeightAll(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_Cctx_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCctxRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := client.Cctx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Cctx_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCctxRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := server.Cctx(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_CctxByNonce_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCctxByNonceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chainID"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chainID")
}
protoReq.ChainID, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chainID", err)
}
val, ok = pathParams["nonce"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonce")
}
protoReq.Nonce, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonce", err)
}
msg, err := client.CctxByNonce(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_CctxByNonce_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCctxByNonceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chainID"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chainID")
}
protoReq.ChainID, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chainID", err)
}
val, ok = pathParams["nonce"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonce")
}
protoReq.Nonce, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonce", err)
}
msg, err := server.CctxByNonce(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_CctxAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_CctxAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllCctxRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.CctxAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_CctxAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllCctxRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.CctxAll(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_CctxAllPending_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_CctxAllPending_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllCctxPendingRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxAllPending_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.CctxAllPending(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_CctxAllPending_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllCctxPendingRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxAllPending_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.CctxAllPending(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_LastZetaHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLastZetaHeightRequest
var metadata runtime.ServerMetadata
msg, err := client.LastZetaHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_LastZetaHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLastZetaHeightRequest
var metadata runtime.ServerMetadata
msg, err := server.LastZetaHeight(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_TssHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTssHistoryRequest
var metadata runtime.ServerMetadata
msg, err := client.TssHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_TssHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTssHistoryRequest
var metadata runtime.ServerMetadata
msg, err := server.TssHistory(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_OutTxTracker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_OutTxTracker_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_OutTxTracker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_OutTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_OutTxTrackerAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_OutTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_OutTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_OutTxTrackerAllByChain_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_OutTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_InTxTrackerAllByChain_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_InTxTrackerAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxHashToCctx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_InTxHashToCctx_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxHashToCctx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxHashToCctxData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_InTxHashToCctxData_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxHashToCctxData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxHashToCctxAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_InTxHashToCctxAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxHashToCctxAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetTssAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetTssAddress_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetTssAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_TSS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_TSS_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TSS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GasPrice_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasPriceAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GasPriceAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasPriceAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ConvertGasToZeta_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ConvertGasToZeta_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ConvertGasToZeta_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ProtocolFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ProtocolFee_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ProtocolFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ChainNonces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ChainNonces_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ChainNonces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ChainNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ChainNoncesAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ChainNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_PendingNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_PendingNoncesAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_PendingNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_PendingNoncesByChain_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_LastBlockHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_LastBlockHeight_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_LastBlockHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_LastBlockHeightAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_LastBlockHeightAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_LastBlockHeightAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Cctx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Cctx_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Cctx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CctxByNonce_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_CctxByNonce_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CctxByNonce_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CctxAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_CctxAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CctxAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CctxAllPending_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_CctxAllPending_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CctxAllPending_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_LastZetaHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_LastZetaHeight_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_LastZetaHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_TssHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_TssHistory_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TssHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterQueryHandler(ctx, mux, conn)
}
// RegisterQueryHandler registers the http handlers for service Query to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
}
// RegisterQueryHandlerClient registers the http handlers for service Query
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_OutTxTracker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_OutTxTracker_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_OutTxTracker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_OutTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_OutTxTrackerAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_OutTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_OutTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_OutTxTrackerAllByChain_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_OutTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_InTxTrackerAllByChain_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_InTxTrackerAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxHashToCctx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_InTxHashToCctx_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxHashToCctx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxHashToCctxData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_InTxHashToCctxData_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxHashToCctxData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_InTxHashToCctxAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_InTxHashToCctxAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_InTxHashToCctxAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetTssAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetTssAddress_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetTssAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_TSS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_TSS_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TSS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GasPrice_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasPriceAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GasPriceAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasPriceAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ConvertGasToZeta_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ConvertGasToZeta_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ConvertGasToZeta_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ProtocolFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ProtocolFee_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ProtocolFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ChainNonces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ChainNonces_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ChainNonces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ChainNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ChainNoncesAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ChainNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_PendingNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_PendingNoncesAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_PendingNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_PendingNoncesByChain_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_LastBlockHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_LastBlockHeight_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_LastBlockHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_LastBlockHeightAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_LastBlockHeightAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_LastBlockHeightAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Cctx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Cctx_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Cctx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CctxByNonce_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_CctxByNonce_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CctxByNonce_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CctxAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_CctxAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CctxAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CctxAllPending_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_CctxAllPending_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CctxAllPending_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_LastZetaHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_LastZetaHeight_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_LastZetaHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_TssHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_TssHistory_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TssHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_OutTxTracker_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"zeta-chain", "crosschain", "outTxTracker", "chainID", "nonce"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_OutTxTrackerAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "outTxTracker"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_OutTxTrackerAllByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "outTxTrackerByChain", "chain"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_InTxTrackerAllByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "inTxTrackerByChain", "chain_id"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_InTxTrackerAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "inTxTrackers"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_InTxHashToCctx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "inTxHashToCctx", "inTxHash"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_InTxHashToCctxData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "in_tx_hash_to_cctx_data", "inTxHash"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_InTxHashToCctxAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "inTxHashToCctx"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetTssAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "get_tss_address"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_TSS_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "TSS"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GasPrice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "gasPrice", "index"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GasPriceAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "gasPrice"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ConvertGasToZeta_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "convertGasToZeta"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ProtocolFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "protocolFee"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ChainNonces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "chainNonces", "index"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ChainNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "chainNonces"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_PendingNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "pendingNonces"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_PendingNoncesByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "pendingNonces", "chain_id"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_LastBlockHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "lastBlockHeight", "index"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_LastBlockHeightAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "lastBlockHeight"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Cctx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "cctx", "index"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_CctxByNonce_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"zeta-chain", "crosschain", "cctx", "chainID", "nonce"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_CctxAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "cctx"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_CctxAllPending_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "cctxPending"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_LastZetaHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "lastZetaHeight"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_TssHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "tssHistory"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_OutTxTracker_0 = runtime.ForwardResponseMessage
forward_Query_OutTxTrackerAll_0 = runtime.ForwardResponseMessage
forward_Query_OutTxTrackerAllByChain_0 = runtime.ForwardResponseMessage
forward_Query_InTxTrackerAllByChain_0 = runtime.ForwardResponseMessage
forward_Query_InTxTrackerAll_0 = runtime.ForwardResponseMessage
forward_Query_InTxHashToCctx_0 = runtime.ForwardResponseMessage
forward_Query_InTxHashToCctxData_0 = runtime.ForwardResponseMessage
forward_Query_InTxHashToCctxAll_0 = runtime.ForwardResponseMessage
forward_Query_GetTssAddress_0 = runtime.ForwardResponseMessage
forward_Query_TSS_0 = runtime.ForwardResponseMessage
forward_Query_GasPrice_0 = runtime.ForwardResponseMessage
forward_Query_GasPriceAll_0 = runtime.ForwardResponseMessage
forward_Query_ConvertGasToZeta_0 = runtime.ForwardResponseMessage
forward_Query_ProtocolFee_0 = runtime.ForwardResponseMessage
forward_Query_ChainNonces_0 = runtime.ForwardResponseMessage
forward_Query_ChainNoncesAll_0 = runtime.ForwardResponseMessage
forward_Query_PendingNoncesAll_0 = runtime.ForwardResponseMessage
forward_Query_PendingNoncesByChain_0 = runtime.ForwardResponseMessage
forward_Query_LastBlockHeight_0 = runtime.ForwardResponseMessage
forward_Query_LastBlockHeightAll_0 = runtime.ForwardResponseMessage
forward_Query_Cctx_0 = runtime.ForwardResponseMessage
forward_Query_CctxByNonce_0 = runtime.ForwardResponseMessage
forward_Query_CctxAll_0 = runtime.ForwardResponseMessage
forward_Query_CctxAllPending_0 = runtime.ForwardResponseMessage
forward_Query_LastZetaHeight_0 = runtime.ForwardResponseMessage
forward_Query_TssHistory_0 = runtime.ForwardResponseMessage
)
package types
import (
"fmt"
)
// empty msg does not overwrite old status message
func (m *Status) ChangeStatus(newStatus CctxStatus, msg string) {
if len(msg) > 0 {
m.StatusMessage = msg
}
if !m.ValidateTransition(newStatus) {
m.StatusMessage = fmt.Sprintf("Failed to transition : OldStatus %s , NewStatus %s , MSG : %s :", m.Status.String(), newStatus.String(), msg)
m.Status = CctxStatus_Aborted
return
}
m.Status = newStatus
} //nolint:typecheck
func (m *Status) ValidateTransition(newStatus CctxStatus) bool {
stateTransitionMap := stateTransitionMap()
oldStatus := m.Status
nextStatusList, isOldStatusValid := stateTransitionMap[oldStatus]
if !isOldStatusValid {
return false
}
for _, status := range nextStatusList {
if status == newStatus {
return true
}
}
return false
}
func stateTransitionMap() map[CctxStatus][]CctxStatus {
stateTransitionMap := make(map[CctxStatus][]CctxStatus)
stateTransitionMap[CctxStatus_PendingInbound] = []CctxStatus{
CctxStatus_PendingOutbound,
CctxStatus_Aborted,
CctxStatus_OutboundMined, // EVM Deposit
CctxStatus_PendingRevert, // EVM Deposit contract call reverted; should refund
}
stateTransitionMap[CctxStatus_PendingOutbound] = []CctxStatus{
CctxStatus_Aborted,
CctxStatus_PendingRevert,
CctxStatus_OutboundMined,
CctxStatus_Reverted,
}
stateTransitionMap[CctxStatus_PendingRevert] = []CctxStatus{
CctxStatus_Aborted,
CctxStatus_OutboundMined,
CctxStatus_Reverted,
}
return stateTransitionMap
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/tss.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type TSS struct {
TssPubkey string `protobuf:"bytes,3,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"`
TssParticipantList []string `protobuf:"bytes,4,rep,name=tss_participant_list,json=tssParticipantList,proto3" json:"tss_participant_list,omitempty"`
OperatorAddressList []string `protobuf:"bytes,5,rep,name=operator_address_list,json=operatorAddressList,proto3" json:"operator_address_list,omitempty"`
FinalizedZetaHeight int64 `protobuf:"varint,6,opt,name=finalizedZetaHeight,proto3" json:"finalizedZetaHeight,omitempty"`
KeyGenZetaHeight int64 `protobuf:"varint,7,opt,name=keyGenZetaHeight,proto3" json:"keyGenZetaHeight,omitempty"`
}
func (m *TSS) Reset() { *m = TSS{} }
func (m *TSS) String() string { return proto.CompactTextString(m) }
func (*TSS) ProtoMessage() {}
func (*TSS) Descriptor() ([]byte, []int) {
return fileDescriptor_ba8ccd105b767be6, []int{0}
}
func (m *TSS) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TSS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TSS.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *TSS) XXX_Merge(src proto.Message) {
xxx_messageInfo_TSS.Merge(m, src)
}
func (m *TSS) XXX_Size() int {
return m.Size()
}
func (m *TSS) XXX_DiscardUnknown() {
xxx_messageInfo_TSS.DiscardUnknown(m)
}
var xxx_messageInfo_TSS proto.InternalMessageInfo
func (m *TSS) GetTssPubkey() string {
if m != nil {
return m.TssPubkey
}
return ""
}
func (m *TSS) GetTssParticipantList() []string {
if m != nil {
return m.TssParticipantList
}
return nil
}
func (m *TSS) GetOperatorAddressList() []string {
if m != nil {
return m.OperatorAddressList
}
return nil
}
func (m *TSS) GetFinalizedZetaHeight() int64 {
if m != nil {
return m.FinalizedZetaHeight
}
return 0
}
func (m *TSS) GetKeyGenZetaHeight() int64 {
if m != nil {
return m.KeyGenZetaHeight
}
return 0
}
func init() {
proto.RegisterType((*TSS)(nil), "zetachain.zetacore.crosschain.TSS")
}
func init() { proto.RegisterFile("crosschain/tss.proto", fileDescriptor_ba8ccd105b767be6) }
var fileDescriptor_ba8ccd105b767be6 = []byte{
// 286 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xf3, 0x40,
0x14, 0x46, 0x3b, 0xe4, 0xff, 0x2b, 0x9d, 0x95, 0x4c, 0x2b, 0x04, 0xa1, 0x43, 0x70, 0x15, 0x04,
0x93, 0xaa, 0x4f, 0xa0, 0x1b, 0x05, 0x5d, 0x48, 0xea, 0xaa, 0x9b, 0x30, 0x49, 0xc6, 0x64, 0x68,
0xcd, 0x84, 0xb9, 0xb7, 0x60, 0xfa, 0x14, 0x3e, 0x96, 0xcb, 0x2e, 0x5d, 0x4a, 0xb2, 0xf1, 0x31,
0x24, 0x13, 0x4a, 0x0b, 0xba, 0xbb, 0xdc, 0x73, 0xbe, 0xcd, 0xa1, 0x93, 0xd4, 0x68, 0x80, 0xb4,
0x10, 0xaa, 0x0c, 0x11, 0x20, 0xa8, 0x8c, 0x46, 0xcd, 0xa6, 0x1b, 0x89, 0xc2, 0x3e, 0x03, 0x7b,
0x69, 0x23, 0x83, 0xbd, 0x78, 0x3a, 0xc9, 0x75, 0xae, 0xad, 0x19, 0x76, 0x57, 0x3f, 0x3a, 0xfb,
0x26, 0xd4, 0x79, 0x9e, 0xcf, 0xd9, 0x94, 0x52, 0x04, 0x88, 0xab, 0x75, 0xb2, 0x94, 0xb5, 0xeb,
0x78, 0xc4, 0x1f, 0x45, 0x23, 0x04, 0x78, 0xb2, 0x0f, 0x36, 0xa3, 0x13, 0x8b, 0x85, 0x41, 0x95,
0xaa, 0x4a, 0x94, 0x18, 0xaf, 0x14, 0xa0, 0xfb, 0xcf, 0x73, 0xfc, 0x51, 0xc4, 0x3a, 0x71, 0x8f,
0x1e, 0x15, 0x20, 0xbb, 0xa2, 0x27, 0xba, 0x92, 0x46, 0xa0, 0x36, 0xb1, 0xc8, 0x32, 0x23, 0x01,
0xfa, 0xc9, 0x7f, 0x3b, 0x19, 0xef, 0xe0, 0x4d, 0xcf, 0xec, 0x66, 0x46, 0xc7, 0x2f, 0xaa, 0x14,
0x2b, 0xb5, 0x91, 0xd9, 0x42, 0xa2, 0xb8, 0x97, 0x2a, 0x2f, 0xd0, 0x1d, 0x7a, 0xc4, 0x77, 0xa2,
0xbf, 0x10, 0x3b, 0xa7, 0xc7, 0x4b, 0x59, 0xdf, 0xc9, 0xf2, 0x40, 0x3f, 0xb2, 0xfa, 0xaf, 0xff,
0xed, 0xc3, 0x47, 0xc3, 0xc9, 0xb6, 0xe1, 0xe4, 0xab, 0xe1, 0xe4, 0xbd, 0xe5, 0x83, 0x6d, 0xcb,
0x07, 0x9f, 0x2d, 0x1f, 0x2c, 0x2e, 0x73, 0x85, 0xc5, 0x3a, 0x09, 0x52, 0xfd, 0x1a, 0x76, 0xe9,
0x2e, 0xfa, 0xb4, 0xbb, 0x8a, 0xe1, 0x5b, 0x78, 0x18, 0xbc, 0xae, 0x24, 0x24, 0x43, 0x9b, 0xef,
0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x52, 0x84, 0x75, 0x8b, 0x01, 0x00, 0x00,
}
func (m *TSS) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *TSS) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TSS) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.KeyGenZetaHeight != 0 {
i = encodeVarintTss(dAtA, i, uint64(m.KeyGenZetaHeight))
i--
dAtA[i] = 0x38
}
if m.FinalizedZetaHeight != 0 {
i = encodeVarintTss(dAtA, i, uint64(m.FinalizedZetaHeight))
i--
dAtA[i] = 0x30
}
if len(m.OperatorAddressList) > 0 {
for iNdEx := len(m.OperatorAddressList) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.OperatorAddressList[iNdEx])
copy(dAtA[i:], m.OperatorAddressList[iNdEx])
i = encodeVarintTss(dAtA, i, uint64(len(m.OperatorAddressList[iNdEx])))
i--
dAtA[i] = 0x2a
}
}
if len(m.TssParticipantList) > 0 {
for iNdEx := len(m.TssParticipantList) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.TssParticipantList[iNdEx])
copy(dAtA[i:], m.TssParticipantList[iNdEx])
i = encodeVarintTss(dAtA, i, uint64(len(m.TssParticipantList[iNdEx])))
i--
dAtA[i] = 0x22
}
}
if len(m.TssPubkey) > 0 {
i -= len(m.TssPubkey)
copy(dAtA[i:], m.TssPubkey)
i = encodeVarintTss(dAtA, i, uint64(len(m.TssPubkey)))
i--
dAtA[i] = 0x1a
}
return len(dAtA) - i, nil
}
func encodeVarintTss(dAtA []byte, offset int, v uint64) int {
offset -= sovTss(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *TSS) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.TssPubkey)
if l > 0 {
n += 1 + l + sovTss(uint64(l))
}
if len(m.TssParticipantList) > 0 {
for _, s := range m.TssParticipantList {
l = len(s)
n += 1 + l + sovTss(uint64(l))
}
}
if len(m.OperatorAddressList) > 0 {
for _, s := range m.OperatorAddressList {
l = len(s)
n += 1 + l + sovTss(uint64(l))
}
}
if m.FinalizedZetaHeight != 0 {
n += 1 + sovTss(uint64(m.FinalizedZetaHeight))
}
if m.KeyGenZetaHeight != 0 {
n += 1 + sovTss(uint64(m.KeyGenZetaHeight))
}
return n
}
func sovTss(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTss(x uint64) (n int) {
return sovTss(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *TSS) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTss
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: TSS: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TSS: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTss
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTss
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTss
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssPubkey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssParticipantList", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTss
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTss
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTss
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssParticipantList = append(m.TssParticipantList, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddressList", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTss
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTss
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTss
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OperatorAddressList = append(m.OperatorAddressList, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field FinalizedZetaHeight", wireType)
}
m.FinalizedZetaHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTss
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.FinalizedZetaHeight |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field KeyGenZetaHeight", wireType)
}
m.KeyGenZetaHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTss
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.KeyGenZetaHeight |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTss(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTss
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTss(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTss
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTss
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTss
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTss
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTss
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTss
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTss = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTss = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTss = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: crosschain/tx.proto
package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type MsgMigrateTssFunds struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"`
}
func (m *MsgMigrateTssFunds) Reset() { *m = MsgMigrateTssFunds{} }
func (m *MsgMigrateTssFunds) String() string { return proto.CompactTextString(m) }
func (*MsgMigrateTssFunds) ProtoMessage() {}
func (*MsgMigrateTssFunds) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{0}
}
func (m *MsgMigrateTssFunds) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgMigrateTssFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgMigrateTssFunds.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgMigrateTssFunds) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgMigrateTssFunds.Merge(m, src)
}
func (m *MsgMigrateTssFunds) XXX_Size() int {
return m.Size()
}
func (m *MsgMigrateTssFunds) XXX_DiscardUnknown() {
xxx_messageInfo_MsgMigrateTssFunds.DiscardUnknown(m)
}
var xxx_messageInfo_MsgMigrateTssFunds proto.InternalMessageInfo
func (m *MsgMigrateTssFunds) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgMigrateTssFunds) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
type MsgMigrateTssFundsResponse struct {
}
func (m *MsgMigrateTssFundsResponse) Reset() { *m = MsgMigrateTssFundsResponse{} }
func (m *MsgMigrateTssFundsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgMigrateTssFundsResponse) ProtoMessage() {}
func (*MsgMigrateTssFundsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{1}
}
func (m *MsgMigrateTssFundsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgMigrateTssFundsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgMigrateTssFundsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgMigrateTssFundsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgMigrateTssFundsResponse.Merge(m, src)
}
func (m *MsgMigrateTssFundsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgMigrateTssFundsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgMigrateTssFundsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgMigrateTssFundsResponse proto.InternalMessageInfo
type MsgAddToInTxTracker struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
CoinType common.CoinType `protobuf:"varint,4,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
Proof *common.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"`
BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
}
func (m *MsgAddToInTxTracker) Reset() { *m = MsgAddToInTxTracker{} }
func (m *MsgAddToInTxTracker) String() string { return proto.CompactTextString(m) }
func (*MsgAddToInTxTracker) ProtoMessage() {}
func (*MsgAddToInTxTracker) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{2}
}
func (m *MsgAddToInTxTracker) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddToInTxTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddToInTxTracker.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddToInTxTracker) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddToInTxTracker.Merge(m, src)
}
func (m *MsgAddToInTxTracker) XXX_Size() int {
return m.Size()
}
func (m *MsgAddToInTxTracker) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddToInTxTracker.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddToInTxTracker proto.InternalMessageInfo
func (m *MsgAddToInTxTracker) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgAddToInTxTracker) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgAddToInTxTracker) GetTxHash() string {
if m != nil {
return m.TxHash
}
return ""
}
func (m *MsgAddToInTxTracker) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *MsgAddToInTxTracker) GetProof() *common.Proof {
if m != nil {
return m.Proof
}
return nil
}
func (m *MsgAddToInTxTracker) GetBlockHash() string {
if m != nil {
return m.BlockHash
}
return ""
}
func (m *MsgAddToInTxTracker) GetTxIndex() int64 {
if m != nil {
return m.TxIndex
}
return 0
}
type MsgAddToInTxTrackerResponse struct {
}
func (m *MsgAddToInTxTrackerResponse) Reset() { *m = MsgAddToInTxTrackerResponse{} }
func (m *MsgAddToInTxTrackerResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAddToInTxTrackerResponse) ProtoMessage() {}
func (*MsgAddToInTxTrackerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{3}
}
func (m *MsgAddToInTxTrackerResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddToInTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddToInTxTrackerResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddToInTxTrackerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddToInTxTrackerResponse.Merge(m, src)
}
func (m *MsgAddToInTxTrackerResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgAddToInTxTrackerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddToInTxTrackerResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddToInTxTrackerResponse proto.InternalMessageInfo
type MsgUpdateTssAddress struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
TssPubkey string `protobuf:"bytes,2,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"`
}
func (m *MsgUpdateTssAddress) Reset() { *m = MsgUpdateTssAddress{} }
func (m *MsgUpdateTssAddress) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateTssAddress) ProtoMessage() {}
func (*MsgUpdateTssAddress) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{4}
}
func (m *MsgUpdateTssAddress) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateTssAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateTssAddress.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateTssAddress) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateTssAddress.Merge(m, src)
}
func (m *MsgUpdateTssAddress) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateTssAddress) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateTssAddress.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateTssAddress proto.InternalMessageInfo
func (m *MsgUpdateTssAddress) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateTssAddress) GetTssPubkey() string {
if m != nil {
return m.TssPubkey
}
return ""
}
type MsgUpdateTssAddressResponse struct {
}
func (m *MsgUpdateTssAddressResponse) Reset() { *m = MsgUpdateTssAddressResponse{} }
func (m *MsgUpdateTssAddressResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateTssAddressResponse) ProtoMessage() {}
func (*MsgUpdateTssAddressResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{5}
}
func (m *MsgUpdateTssAddressResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateTssAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateTssAddressResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateTssAddressResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateTssAddressResponse.Merge(m, src)
}
func (m *MsgUpdateTssAddressResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateTssAddressResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateTssAddressResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateTssAddressResponse proto.InternalMessageInfo
type MsgWhitelistERC20 struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Erc20Address string `protobuf:"bytes,2,opt,name=erc20_address,json=erc20Address,proto3" json:"erc20_address,omitempty"`
ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Symbol string `protobuf:"bytes,5,opt,name=symbol,proto3" json:"symbol,omitempty"`
Decimals uint32 `protobuf:"varint,6,opt,name=decimals,proto3" json:"decimals,omitempty"`
GasLimit int64 `protobuf:"varint,7,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
}
func (m *MsgWhitelistERC20) Reset() { *m = MsgWhitelistERC20{} }
func (m *MsgWhitelistERC20) String() string { return proto.CompactTextString(m) }
func (*MsgWhitelistERC20) ProtoMessage() {}
func (*MsgWhitelistERC20) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{6}
}
func (m *MsgWhitelistERC20) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgWhitelistERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgWhitelistERC20.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgWhitelistERC20) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgWhitelistERC20.Merge(m, src)
}
func (m *MsgWhitelistERC20) XXX_Size() int {
return m.Size()
}
func (m *MsgWhitelistERC20) XXX_DiscardUnknown() {
xxx_messageInfo_MsgWhitelistERC20.DiscardUnknown(m)
}
var xxx_messageInfo_MsgWhitelistERC20 proto.InternalMessageInfo
func (m *MsgWhitelistERC20) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgWhitelistERC20) GetErc20Address() string {
if m != nil {
return m.Erc20Address
}
return ""
}
func (m *MsgWhitelistERC20) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgWhitelistERC20) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *MsgWhitelistERC20) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
func (m *MsgWhitelistERC20) GetDecimals() uint32 {
if m != nil {
return m.Decimals
}
return 0
}
func (m *MsgWhitelistERC20) GetGasLimit() int64 {
if m != nil {
return m.GasLimit
}
return 0
}
type MsgWhitelistERC20Response struct {
Zrc20Address string `protobuf:"bytes,1,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"`
CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
}
func (m *MsgWhitelistERC20Response) Reset() { *m = MsgWhitelistERC20Response{} }
func (m *MsgWhitelistERC20Response) String() string { return proto.CompactTextString(m) }
func (*MsgWhitelistERC20Response) ProtoMessage() {}
func (*MsgWhitelistERC20Response) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{7}
}
func (m *MsgWhitelistERC20Response) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgWhitelistERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgWhitelistERC20Response.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgWhitelistERC20Response) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgWhitelistERC20Response.Merge(m, src)
}
func (m *MsgWhitelistERC20Response) XXX_Size() int {
return m.Size()
}
func (m *MsgWhitelistERC20Response) XXX_DiscardUnknown() {
xxx_messageInfo_MsgWhitelistERC20Response.DiscardUnknown(m)
}
var xxx_messageInfo_MsgWhitelistERC20Response proto.InternalMessageInfo
func (m *MsgWhitelistERC20Response) GetZrc20Address() string {
if m != nil {
return m.Zrc20Address
}
return ""
}
func (m *MsgWhitelistERC20Response) GetCctxIndex() string {
if m != nil {
return m.CctxIndex
}
return ""
}
type MsgAddToOutTxTracker struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
Proof *common.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"`
BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
}
func (m *MsgAddToOutTxTracker) Reset() { *m = MsgAddToOutTxTracker{} }
func (m *MsgAddToOutTxTracker) String() string { return proto.CompactTextString(m) }
func (*MsgAddToOutTxTracker) ProtoMessage() {}
func (*MsgAddToOutTxTracker) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{8}
}
func (m *MsgAddToOutTxTracker) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddToOutTxTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddToOutTxTracker.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddToOutTxTracker) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddToOutTxTracker.Merge(m, src)
}
func (m *MsgAddToOutTxTracker) XXX_Size() int {
return m.Size()
}
func (m *MsgAddToOutTxTracker) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddToOutTxTracker.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddToOutTxTracker proto.InternalMessageInfo
func (m *MsgAddToOutTxTracker) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgAddToOutTxTracker) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgAddToOutTxTracker) GetNonce() uint64 {
if m != nil {
return m.Nonce
}
return 0
}
func (m *MsgAddToOutTxTracker) GetTxHash() string {
if m != nil {
return m.TxHash
}
return ""
}
func (m *MsgAddToOutTxTracker) GetProof() *common.Proof {
if m != nil {
return m.Proof
}
return nil
}
func (m *MsgAddToOutTxTracker) GetBlockHash() string {
if m != nil {
return m.BlockHash
}
return ""
}
func (m *MsgAddToOutTxTracker) GetTxIndex() int64 {
if m != nil {
return m.TxIndex
}
return 0
}
type MsgAddToOutTxTrackerResponse struct {
}
func (m *MsgAddToOutTxTrackerResponse) Reset() { *m = MsgAddToOutTxTrackerResponse{} }
func (m *MsgAddToOutTxTrackerResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAddToOutTxTrackerResponse) ProtoMessage() {}
func (*MsgAddToOutTxTrackerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{9}
}
func (m *MsgAddToOutTxTrackerResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddToOutTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddToOutTxTrackerResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddToOutTxTrackerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddToOutTxTrackerResponse.Merge(m, src)
}
func (m *MsgAddToOutTxTrackerResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgAddToOutTxTrackerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddToOutTxTrackerResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddToOutTxTrackerResponse proto.InternalMessageInfo
type MsgRemoveFromOutTxTracker struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
}
func (m *MsgRemoveFromOutTxTracker) Reset() { *m = MsgRemoveFromOutTxTracker{} }
func (m *MsgRemoveFromOutTxTracker) String() string { return proto.CompactTextString(m) }
func (*MsgRemoveFromOutTxTracker) ProtoMessage() {}
func (*MsgRemoveFromOutTxTracker) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{10}
}
func (m *MsgRemoveFromOutTxTracker) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgRemoveFromOutTxTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgRemoveFromOutTxTracker.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgRemoveFromOutTxTracker) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgRemoveFromOutTxTracker.Merge(m, src)
}
func (m *MsgRemoveFromOutTxTracker) XXX_Size() int {
return m.Size()
}
func (m *MsgRemoveFromOutTxTracker) XXX_DiscardUnknown() {
xxx_messageInfo_MsgRemoveFromOutTxTracker.DiscardUnknown(m)
}
var xxx_messageInfo_MsgRemoveFromOutTxTracker proto.InternalMessageInfo
func (m *MsgRemoveFromOutTxTracker) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgRemoveFromOutTxTracker) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgRemoveFromOutTxTracker) GetNonce() uint64 {
if m != nil {
return m.Nonce
}
return 0
}
type MsgRemoveFromOutTxTrackerResponse struct {
}
func (m *MsgRemoveFromOutTxTrackerResponse) Reset() { *m = MsgRemoveFromOutTxTrackerResponse{} }
func (m *MsgRemoveFromOutTxTrackerResponse) String() string { return proto.CompactTextString(m) }
func (*MsgRemoveFromOutTxTrackerResponse) ProtoMessage() {}
func (*MsgRemoveFromOutTxTrackerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{11}
}
func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.Merge(m, src)
}
func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgRemoveFromOutTxTrackerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse proto.InternalMessageInfo
type MsgCreateTSSVoter struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
TssPubkey string `protobuf:"bytes,2,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"`
KeyGenZetaHeight int64 `protobuf:"varint,3,opt,name=keyGenZetaHeight,proto3" json:"keyGenZetaHeight,omitempty"`
Status common.ReceiveStatus `protobuf:"varint,4,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"`
}
func (m *MsgCreateTSSVoter) Reset() { *m = MsgCreateTSSVoter{} }
func (m *MsgCreateTSSVoter) String() string { return proto.CompactTextString(m) }
func (*MsgCreateTSSVoter) ProtoMessage() {}
func (*MsgCreateTSSVoter) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{12}
}
func (m *MsgCreateTSSVoter) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgCreateTSSVoter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgCreateTSSVoter.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgCreateTSSVoter) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgCreateTSSVoter.Merge(m, src)
}
func (m *MsgCreateTSSVoter) XXX_Size() int {
return m.Size()
}
func (m *MsgCreateTSSVoter) XXX_DiscardUnknown() {
xxx_messageInfo_MsgCreateTSSVoter.DiscardUnknown(m)
}
var xxx_messageInfo_MsgCreateTSSVoter proto.InternalMessageInfo
func (m *MsgCreateTSSVoter) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgCreateTSSVoter) GetTssPubkey() string {
if m != nil {
return m.TssPubkey
}
return ""
}
func (m *MsgCreateTSSVoter) GetKeyGenZetaHeight() int64 {
if m != nil {
return m.KeyGenZetaHeight
}
return 0
}
func (m *MsgCreateTSSVoter) GetStatus() common.ReceiveStatus {
if m != nil {
return m.Status
}
return common.ReceiveStatus_Created
}
type MsgCreateTSSVoterResponse struct {
}
func (m *MsgCreateTSSVoterResponse) Reset() { *m = MsgCreateTSSVoterResponse{} }
func (m *MsgCreateTSSVoterResponse) String() string { return proto.CompactTextString(m) }
func (*MsgCreateTSSVoterResponse) ProtoMessage() {}
func (*MsgCreateTSSVoterResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{13}
}
func (m *MsgCreateTSSVoterResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgCreateTSSVoterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgCreateTSSVoterResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgCreateTSSVoterResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgCreateTSSVoterResponse.Merge(m, src)
}
func (m *MsgCreateTSSVoterResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgCreateTSSVoterResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgCreateTSSVoterResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgCreateTSSVoterResponse proto.InternalMessageInfo
type MsgGasPriceVoter struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Price uint64 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
Supply string `protobuf:"bytes,5,opt,name=supply,proto3" json:"supply,omitempty"`
}
func (m *MsgGasPriceVoter) Reset() { *m = MsgGasPriceVoter{} }
func (m *MsgGasPriceVoter) String() string { return proto.CompactTextString(m) }
func (*MsgGasPriceVoter) ProtoMessage() {}
func (*MsgGasPriceVoter) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{14}
}
func (m *MsgGasPriceVoter) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgGasPriceVoter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgGasPriceVoter.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgGasPriceVoter) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgGasPriceVoter.Merge(m, src)
}
func (m *MsgGasPriceVoter) XXX_Size() int {
return m.Size()
}
func (m *MsgGasPriceVoter) XXX_DiscardUnknown() {
xxx_messageInfo_MsgGasPriceVoter.DiscardUnknown(m)
}
var xxx_messageInfo_MsgGasPriceVoter proto.InternalMessageInfo
func (m *MsgGasPriceVoter) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgGasPriceVoter) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgGasPriceVoter) GetPrice() uint64 {
if m != nil {
return m.Price
}
return 0
}
func (m *MsgGasPriceVoter) GetBlockNumber() uint64 {
if m != nil {
return m.BlockNumber
}
return 0
}
func (m *MsgGasPriceVoter) GetSupply() string {
if m != nil {
return m.Supply
}
return ""
}
type MsgGasPriceVoterResponse struct {
}
func (m *MsgGasPriceVoterResponse) Reset() { *m = MsgGasPriceVoterResponse{} }
func (m *MsgGasPriceVoterResponse) String() string { return proto.CompactTextString(m) }
func (*MsgGasPriceVoterResponse) ProtoMessage() {}
func (*MsgGasPriceVoterResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{15}
}
func (m *MsgGasPriceVoterResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgGasPriceVoterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgGasPriceVoterResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgGasPriceVoterResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgGasPriceVoterResponse.Merge(m, src)
}
func (m *MsgGasPriceVoterResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgGasPriceVoterResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgGasPriceVoterResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgGasPriceVoterResponse proto.InternalMessageInfo
type MsgNonceVoter struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
}
func (m *MsgNonceVoter) Reset() { *m = MsgNonceVoter{} }
func (m *MsgNonceVoter) String() string { return proto.CompactTextString(m) }
func (*MsgNonceVoter) ProtoMessage() {}
func (*MsgNonceVoter) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{16}
}
func (m *MsgNonceVoter) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgNonceVoter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgNonceVoter.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgNonceVoter) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgNonceVoter.Merge(m, src)
}
func (m *MsgNonceVoter) XXX_Size() int {
return m.Size()
}
func (m *MsgNonceVoter) XXX_DiscardUnknown() {
xxx_messageInfo_MsgNonceVoter.DiscardUnknown(m)
}
var xxx_messageInfo_MsgNonceVoter proto.InternalMessageInfo
func (m *MsgNonceVoter) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgNonceVoter) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgNonceVoter) GetNonce() uint64 {
if m != nil {
return m.Nonce
}
return 0
}
type MsgNonceVoterResponse struct {
}
func (m *MsgNonceVoterResponse) Reset() { *m = MsgNonceVoterResponse{} }
func (m *MsgNonceVoterResponse) String() string { return proto.CompactTextString(m) }
func (*MsgNonceVoterResponse) ProtoMessage() {}
func (*MsgNonceVoterResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{17}
}
func (m *MsgNonceVoterResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgNonceVoterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgNonceVoterResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgNonceVoterResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgNonceVoterResponse.Merge(m, src)
}
func (m *MsgNonceVoterResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgNonceVoterResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgNonceVoterResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgNonceVoterResponse proto.InternalMessageInfo
type MsgVoteOnObservedOutboundTx struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
CctxHash string `protobuf:"bytes,2,opt,name=cctx_hash,json=cctxHash,proto3" json:"cctx_hash,omitempty"`
ObservedOutTxHash string `protobuf:"bytes,3,opt,name=observed_outTx_hash,json=observedOutTxHash,proto3" json:"observed_outTx_hash,omitempty"`
ObservedOutTxBlockHeight uint64 `protobuf:"varint,4,opt,name=observed_outTx_blockHeight,json=observedOutTxBlockHeight,proto3" json:"observed_outTx_blockHeight,omitempty"`
ObservedOutTxGasUsed uint64 `protobuf:"varint,10,opt,name=observed_outTx_gas_used,json=observedOutTxGasUsed,proto3" json:"observed_outTx_gas_used,omitempty"`
ObservedOutTxEffectiveGasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=observed_outTx_effective_gas_price,json=observedOutTxEffectiveGasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"observed_outTx_effective_gas_price"`
ObservedOutTxEffectiveGasLimit uint64 `protobuf:"varint,12,opt,name=observed_outTx_effective_gas_limit,json=observedOutTxEffectiveGasLimit,proto3" json:"observed_outTx_effective_gas_limit,omitempty"`
ValueReceived github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"value_received" yaml:"value_received"`
Status common.ReceiveStatus `protobuf:"varint,6,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"`
OutTxChain int64 `protobuf:"varint,7,opt,name=outTx_chain,json=outTxChain,proto3" json:"outTx_chain,omitempty"`
OutTxTssNonce uint64 `protobuf:"varint,8,opt,name=outTx_tss_nonce,json=outTxTssNonce,proto3" json:"outTx_tss_nonce,omitempty"`
CoinType common.CoinType `protobuf:"varint,9,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
}
func (m *MsgVoteOnObservedOutboundTx) Reset() { *m = MsgVoteOnObservedOutboundTx{} }
func (m *MsgVoteOnObservedOutboundTx) String() string { return proto.CompactTextString(m) }
func (*MsgVoteOnObservedOutboundTx) ProtoMessage() {}
func (*MsgVoteOnObservedOutboundTx) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{18}
}
func (m *MsgVoteOnObservedOutboundTx) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgVoteOnObservedOutboundTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgVoteOnObservedOutboundTx.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgVoteOnObservedOutboundTx) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgVoteOnObservedOutboundTx.Merge(m, src)
}
func (m *MsgVoteOnObservedOutboundTx) XXX_Size() int {
return m.Size()
}
func (m *MsgVoteOnObservedOutboundTx) XXX_DiscardUnknown() {
xxx_messageInfo_MsgVoteOnObservedOutboundTx.DiscardUnknown(m)
}
var xxx_messageInfo_MsgVoteOnObservedOutboundTx proto.InternalMessageInfo
func (m *MsgVoteOnObservedOutboundTx) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgVoteOnObservedOutboundTx) GetCctxHash() string {
if m != nil {
return m.CctxHash
}
return ""
}
func (m *MsgVoteOnObservedOutboundTx) GetObservedOutTxHash() string {
if m != nil {
return m.ObservedOutTxHash
}
return ""
}
func (m *MsgVoteOnObservedOutboundTx) GetObservedOutTxBlockHeight() uint64 {
if m != nil {
return m.ObservedOutTxBlockHeight
}
return 0
}
func (m *MsgVoteOnObservedOutboundTx) GetObservedOutTxGasUsed() uint64 {
if m != nil {
return m.ObservedOutTxGasUsed
}
return 0
}
func (m *MsgVoteOnObservedOutboundTx) GetObservedOutTxEffectiveGasLimit() uint64 {
if m != nil {
return m.ObservedOutTxEffectiveGasLimit
}
return 0
}
func (m *MsgVoteOnObservedOutboundTx) GetStatus() common.ReceiveStatus {
if m != nil {
return m.Status
}
return common.ReceiveStatus_Created
}
func (m *MsgVoteOnObservedOutboundTx) GetOutTxChain() int64 {
if m != nil {
return m.OutTxChain
}
return 0
}
func (m *MsgVoteOnObservedOutboundTx) GetOutTxTssNonce() uint64 {
if m != nil {
return m.OutTxTssNonce
}
return 0
}
func (m *MsgVoteOnObservedOutboundTx) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
type MsgVoteOnObservedOutboundTxResponse struct {
}
func (m *MsgVoteOnObservedOutboundTxResponse) Reset() { *m = MsgVoteOnObservedOutboundTxResponse{} }
func (m *MsgVoteOnObservedOutboundTxResponse) String() string { return proto.CompactTextString(m) }
func (*MsgVoteOnObservedOutboundTxResponse) ProtoMessage() {}
func (*MsgVoteOnObservedOutboundTxResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{19}
}
func (m *MsgVoteOnObservedOutboundTxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgVoteOnObservedOutboundTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgVoteOnObservedOutboundTxResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgVoteOnObservedOutboundTxResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgVoteOnObservedOutboundTxResponse.Merge(m, src)
}
func (m *MsgVoteOnObservedOutboundTxResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgVoteOnObservedOutboundTxResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgVoteOnObservedOutboundTxResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgVoteOnObservedOutboundTxResponse proto.InternalMessageInfo
type MsgVoteOnObservedInboundTx struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"`
SenderChainId int64 `protobuf:"varint,3,opt,name=sender_chain_id,json=senderChainId,proto3" json:"sender_chain_id,omitempty"`
Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"`
ReceiverChain int64 `protobuf:"varint,5,opt,name=receiver_chain,json=receiverChain,proto3" json:"receiver_chain,omitempty"`
// string zeta_burnt = 6;
Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"`
// string mMint = 7;
Message string `protobuf:"bytes,8,opt,name=message,proto3" json:"message,omitempty"`
InTxHash string `protobuf:"bytes,9,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"`
InBlockHeight uint64 `protobuf:"varint,10,opt,name=in_block_height,json=inBlockHeight,proto3" json:"in_block_height,omitempty"`
GasLimit uint64 `protobuf:"varint,11,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
CoinType common.CoinType `protobuf:"varint,12,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
TxOrigin string `protobuf:"bytes,13,opt,name=tx_origin,json=txOrigin,proto3" json:"tx_origin,omitempty"`
Asset string `protobuf:"bytes,14,opt,name=asset,proto3" json:"asset,omitempty"`
}
func (m *MsgVoteOnObservedInboundTx) Reset() { *m = MsgVoteOnObservedInboundTx{} }
func (m *MsgVoteOnObservedInboundTx) String() string { return proto.CompactTextString(m) }
func (*MsgVoteOnObservedInboundTx) ProtoMessage() {}
func (*MsgVoteOnObservedInboundTx) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{20}
}
func (m *MsgVoteOnObservedInboundTx) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgVoteOnObservedInboundTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgVoteOnObservedInboundTx.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgVoteOnObservedInboundTx) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgVoteOnObservedInboundTx.Merge(m, src)
}
func (m *MsgVoteOnObservedInboundTx) XXX_Size() int {
return m.Size()
}
func (m *MsgVoteOnObservedInboundTx) XXX_DiscardUnknown() {
xxx_messageInfo_MsgVoteOnObservedInboundTx.DiscardUnknown(m)
}
var xxx_messageInfo_MsgVoteOnObservedInboundTx proto.InternalMessageInfo
func (m *MsgVoteOnObservedInboundTx) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgVoteOnObservedInboundTx) GetSender() string {
if m != nil {
return m.Sender
}
return ""
}
func (m *MsgVoteOnObservedInboundTx) GetSenderChainId() int64 {
if m != nil {
return m.SenderChainId
}
return 0
}
func (m *MsgVoteOnObservedInboundTx) GetReceiver() string {
if m != nil {
return m.Receiver
}
return ""
}
func (m *MsgVoteOnObservedInboundTx) GetReceiverChain() int64 {
if m != nil {
return m.ReceiverChain
}
return 0
}
func (m *MsgVoteOnObservedInboundTx) GetMessage() string {
if m != nil {
return m.Message
}
return ""
}
func (m *MsgVoteOnObservedInboundTx) GetInTxHash() string {
if m != nil {
return m.InTxHash
}
return ""
}
func (m *MsgVoteOnObservedInboundTx) GetInBlockHeight() uint64 {
if m != nil {
return m.InBlockHeight
}
return 0
}
func (m *MsgVoteOnObservedInboundTx) GetGasLimit() uint64 {
if m != nil {
return m.GasLimit
}
return 0
}
func (m *MsgVoteOnObservedInboundTx) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *MsgVoteOnObservedInboundTx) GetTxOrigin() string {
if m != nil {
return m.TxOrigin
}
return ""
}
func (m *MsgVoteOnObservedInboundTx) GetAsset() string {
if m != nil {
return m.Asset
}
return ""
}
type MsgVoteOnObservedInboundTxResponse struct {
}
func (m *MsgVoteOnObservedInboundTxResponse) Reset() { *m = MsgVoteOnObservedInboundTxResponse{} }
func (m *MsgVoteOnObservedInboundTxResponse) String() string { return proto.CompactTextString(m) }
func (*MsgVoteOnObservedInboundTxResponse) ProtoMessage() {}
func (*MsgVoteOnObservedInboundTxResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{21}
}
func (m *MsgVoteOnObservedInboundTxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgVoteOnObservedInboundTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgVoteOnObservedInboundTxResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.Merge(m, src)
}
func (m *MsgVoteOnObservedInboundTxResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgVoteOnObservedInboundTxResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgVoteOnObservedInboundTxResponse proto.InternalMessageInfo
type MsgSetNodeKeys struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
PubkeySet *common.PubKeySet `protobuf:"bytes,2,opt,name=pubkeySet,proto3" json:"pubkeySet,omitempty"`
TssSigner_Address string `protobuf:"bytes,3,opt,name=tss_signer_Address,json=tssSignerAddress,proto3" json:"tss_signer_Address,omitempty"`
}
func (m *MsgSetNodeKeys) Reset() { *m = MsgSetNodeKeys{} }
func (m *MsgSetNodeKeys) String() string { return proto.CompactTextString(m) }
func (*MsgSetNodeKeys) ProtoMessage() {}
func (*MsgSetNodeKeys) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{22}
}
func (m *MsgSetNodeKeys) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgSetNodeKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgSetNodeKeys.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgSetNodeKeys) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgSetNodeKeys.Merge(m, src)
}
func (m *MsgSetNodeKeys) XXX_Size() int {
return m.Size()
}
func (m *MsgSetNodeKeys) XXX_DiscardUnknown() {
xxx_messageInfo_MsgSetNodeKeys.DiscardUnknown(m)
}
var xxx_messageInfo_MsgSetNodeKeys proto.InternalMessageInfo
func (m *MsgSetNodeKeys) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgSetNodeKeys) GetPubkeySet() *common.PubKeySet {
if m != nil {
return m.PubkeySet
}
return nil
}
func (m *MsgSetNodeKeys) GetTssSigner_Address() string {
if m != nil {
return m.TssSigner_Address
}
return ""
}
type MsgSetNodeKeysResponse struct {
}
func (m *MsgSetNodeKeysResponse) Reset() { *m = MsgSetNodeKeysResponse{} }
func (m *MsgSetNodeKeysResponse) String() string { return proto.CompactTextString(m) }
func (*MsgSetNodeKeysResponse) ProtoMessage() {}
func (*MsgSetNodeKeysResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_81d6d611190b7635, []int{23}
}
func (m *MsgSetNodeKeysResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgSetNodeKeysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgSetNodeKeysResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgSetNodeKeysResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgSetNodeKeysResponse.Merge(m, src)
}
func (m *MsgSetNodeKeysResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgSetNodeKeysResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgSetNodeKeysResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgSetNodeKeysResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgMigrateTssFunds)(nil), "zetachain.zetacore.crosschain.MsgMigrateTssFunds")
proto.RegisterType((*MsgMigrateTssFundsResponse)(nil), "zetachain.zetacore.crosschain.MsgMigrateTssFundsResponse")
proto.RegisterType((*MsgAddToInTxTracker)(nil), "zetachain.zetacore.crosschain.MsgAddToInTxTracker")
proto.RegisterType((*MsgAddToInTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.MsgAddToInTxTrackerResponse")
proto.RegisterType((*MsgUpdateTssAddress)(nil), "zetachain.zetacore.crosschain.MsgUpdateTssAddress")
proto.RegisterType((*MsgUpdateTssAddressResponse)(nil), "zetachain.zetacore.crosschain.MsgUpdateTssAddressResponse")
proto.RegisterType((*MsgWhitelistERC20)(nil), "zetachain.zetacore.crosschain.MsgWhitelistERC20")
proto.RegisterType((*MsgWhitelistERC20Response)(nil), "zetachain.zetacore.crosschain.MsgWhitelistERC20Response")
proto.RegisterType((*MsgAddToOutTxTracker)(nil), "zetachain.zetacore.crosschain.MsgAddToOutTxTracker")
proto.RegisterType((*MsgAddToOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.MsgAddToOutTxTrackerResponse")
proto.RegisterType((*MsgRemoveFromOutTxTracker)(nil), "zetachain.zetacore.crosschain.MsgRemoveFromOutTxTracker")
proto.RegisterType((*MsgRemoveFromOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.MsgRemoveFromOutTxTrackerResponse")
proto.RegisterType((*MsgCreateTSSVoter)(nil), "zetachain.zetacore.crosschain.MsgCreateTSSVoter")
proto.RegisterType((*MsgCreateTSSVoterResponse)(nil), "zetachain.zetacore.crosschain.MsgCreateTSSVoterResponse")
proto.RegisterType((*MsgGasPriceVoter)(nil), "zetachain.zetacore.crosschain.MsgGasPriceVoter")
proto.RegisterType((*MsgGasPriceVoterResponse)(nil), "zetachain.zetacore.crosschain.MsgGasPriceVoterResponse")
proto.RegisterType((*MsgNonceVoter)(nil), "zetachain.zetacore.crosschain.MsgNonceVoter")
proto.RegisterType((*MsgNonceVoterResponse)(nil), "zetachain.zetacore.crosschain.MsgNonceVoterResponse")
proto.RegisterType((*MsgVoteOnObservedOutboundTx)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx")
proto.RegisterType((*MsgVoteOnObservedOutboundTxResponse)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTxResponse")
proto.RegisterType((*MsgVoteOnObservedInboundTx)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx")
proto.RegisterType((*MsgVoteOnObservedInboundTxResponse)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTxResponse")
proto.RegisterType((*MsgSetNodeKeys)(nil), "zetachain.zetacore.crosschain.MsgSetNodeKeys")
proto.RegisterType((*MsgSetNodeKeysResponse)(nil), "zetachain.zetacore.crosschain.MsgSetNodeKeysResponse")
}
func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) }
var fileDescriptor_81d6d611190b7635 = []byte{
// 1487 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xdd, 0x4e, 0x1b, 0xc7,
0x17, 0x67, 0xff, 0x80, 0xb1, 0x8f, 0x31, 0x81, 0x85, 0x84, 0xcd, 0x12, 0x0c, 0x59, 0xfe, 0x49,
0x51, 0x15, 0xec, 0xc4, 0x69, 0xd5, 0x24, 0xed, 0x45, 0x03, 0x4a, 0x08, 0x4d, 0x0d, 0xd1, 0xe2,
0xb4, 0x52, 0x6e, 0x56, 0xeb, 0xdd, 0x61, 0xbd, 0xc2, 0xbb, 0x63, 0xed, 0x8c, 0x91, 0x8d, 0x2a,
0x55, 0xaa, 0xd4, 0x8b, 0xde, 0x55, 0x55, 0xa5, 0x56, 0x7d, 0x81, 0xbe, 0x4a, 0xee, 0x1a, 0xf5,
0xaa, 0xe9, 0x45, 0xd4, 0x26, 0x4f, 0xd0, 0x3e, 0x41, 0xb5, 0x33, 0xb3, 0x8b, 0xd7, 0xe0, 0x2f,
0xa2, 0x5c, 0x79, 0xce, 0xd9, 0xf9, 0x9d, 0xef, 0x33, 0x73, 0xc6, 0x30, 0x6f, 0x05, 0x98, 0x10,
0xab, 0x66, 0xba, 0x7e, 0x91, 0xb6, 0x0a, 0x8d, 0x00, 0x53, 0x2c, 0x2f, 0x1f, 0x23, 0x6a, 0x32,
0x5e, 0x81, 0xad, 0x70, 0x80, 0x0a, 0x27, 0xfb, 0xd4, 0x79, 0x0b, 0x7b, 0x1e, 0xf6, 0x8b, 0xfc,
0x87, 0x63, 0xd4, 0x05, 0x07, 0x3b, 0x98, 0x2d, 0x8b, 0xe1, 0x8a, 0x73, 0xb5, 0x1f, 0x24, 0x90,
0xcb, 0xc4, 0x29, 0xbb, 0x4e, 0x60, 0x52, 0x54, 0x21, 0xe4, 0x61, 0xd3, 0xb7, 0x89, 0xac, 0xc0,
0x94, 0x15, 0x20, 0x93, 0xe2, 0x40, 0x91, 0x56, 0xa5, 0xf5, 0x8c, 0x1e, 0x91, 0xf2, 0x65, 0x48,
0x33, 0x25, 0x86, 0x6b, 0x2b, 0xff, 0x5b, 0x95, 0xd6, 0xc7, 0xf5, 0x29, 0x46, 0xef, 0xd8, 0xf2,
0x36, 0xa4, 0x4c, 0x0f, 0x37, 0x7d, 0xaa, 0x8c, 0x87, 0x98, 0xcd, 0xe2, 0xf3, 0x57, 0x2b, 0x63,
0x7f, 0xbe, 0x5a, 0x79, 0xcf, 0x71, 0x69, 0xad, 0x59, 0x2d, 0x58, 0xd8, 0x2b, 0x5a, 0x98, 0x78,
0x98, 0x88, 0x9f, 0x0d, 0x62, 0x1f, 0x16, 0x69, 0xbb, 0x81, 0x48, 0xe1, 0xa9, 0xeb, 0x53, 0x5d,
0xc0, 0xb5, 0x2b, 0xa0, 0x9e, 0xb6, 0x49, 0x47, 0xa4, 0x81, 0x7d, 0x82, 0xb4, 0x7f, 0x24, 0x98,
0x2f, 0x13, 0xe7, 0xbe, 0x6d, 0x57, 0xf0, 0x8e, 0x5f, 0x69, 0x55, 0x02, 0xd3, 0x3a, 0x44, 0xc1,
0xf9, 0x6c, 0x5e, 0x84, 0x29, 0xda, 0x32, 0x6a, 0x26, 0xa9, 0x71, 0xa3, 0xf5, 0x14, 0x6d, 0x3d,
0x32, 0x49, 0x4d, 0xde, 0x80, 0x8c, 0x85, 0x5d, 0xdf, 0x08, 0xcd, 0x53, 0x26, 0x56, 0xa5, 0xf5,
0x99, 0xd2, 0x6c, 0x41, 0x04, 0x74, 0x0b, 0xbb, 0x7e, 0xa5, 0xdd, 0x40, 0x7a, 0xda, 0x12, 0x2b,
0x79, 0x0d, 0x26, 0x1b, 0x01, 0xc6, 0x07, 0xca, 0xe4, 0xaa, 0xb4, 0x9e, 0x2d, 0xe5, 0xa2, 0xad,
0x4f, 0x42, 0xa6, 0xce, 0xbf, 0xc9, 0xcb, 0x00, 0xd5, 0x3a, 0xb6, 0x0e, 0xb9, 0xbe, 0x14, 0xd3,
0x97, 0x61, 0x1c, 0xa6, 0xf2, 0x32, 0xa4, 0x69, 0xcb, 0x70, 0x7d, 0x1b, 0xb5, 0x94, 0x29, 0x6e,
0x26, 0x6d, 0xed, 0x84, 0xa4, 0xb6, 0x0c, 0x4b, 0x67, 0xb8, 0x1c, 0x87, 0x64, 0x97, 0x45, 0xe4,
0x69, 0xc3, 0xe6, 0xf1, 0xba, 0x6f, 0xdb, 0x01, 0x22, 0xfd, 0xb2, 0xb8, 0x0c, 0x40, 0x09, 0x31,
0x1a, 0xcd, 0xea, 0x21, 0x6a, 0xb3, 0x98, 0x64, 0xf4, 0x0c, 0x25, 0xe4, 0x09, 0x63, 0x08, 0x75,
0xdd, 0xf2, 0x62, 0x75, 0xbf, 0x4b, 0x30, 0x57, 0x26, 0xce, 0x97, 0x35, 0x97, 0xa2, 0xba, 0x4b,
0xe8, 0x03, 0x7d, 0xab, 0x74, 0xb3, 0x8f, 0xb6, 0x35, 0xc8, 0xa1, 0xc0, 0x2a, 0xdd, 0x34, 0x4c,
0x2e, 0x48, 0x28, 0x9c, 0x66, 0xcc, 0xc8, 0xd8, 0xce, 0x24, 0x8d, 0x27, 0x93, 0x24, 0xc3, 0x84,
0x6f, 0x7a, 0x3c, 0x0d, 0x19, 0x9d, 0xad, 0xe5, 0x4b, 0x90, 0x22, 0x6d, 0xaf, 0x8a, 0xeb, 0x2c,
0xe2, 0x19, 0x5d, 0x50, 0xb2, 0x0a, 0x69, 0x1b, 0x59, 0xae, 0x67, 0xd6, 0x09, 0x8b, 0x70, 0x4e,
0x8f, 0x69, 0x79, 0x09, 0x32, 0x8e, 0x49, 0x8c, 0xba, 0xeb, 0xb9, 0x54, 0x44, 0x38, 0xed, 0x98,
0xe4, 0xf3, 0x90, 0xd6, 0x0c, 0xb8, 0x7c, 0xca, 0xa7, 0xc8, 0xe3, 0xd0, 0x83, 0xe3, 0x84, 0x07,
0xdc, 0xc3, 0xe9, 0xe3, 0x4e, 0x0f, 0x96, 0x01, 0x2c, 0x2b, 0xce, 0xa0, 0x08, 0x6a, 0xc8, 0xe1,
0x39, 0x7c, 0x29, 0xc1, 0x42, 0x94, 0xc4, 0xbd, 0x26, 0x7d, 0xcb, 0xc2, 0x5d, 0x80, 0x49, 0x1f,
0xfb, 0x16, 0x62, 0xb1, 0x9a, 0xd0, 0x39, 0xd1, 0x59, 0xce, 0x13, 0x89, 0x72, 0x7e, 0xc7, 0xf5,
0x99, 0x87, 0x2b, 0x67, 0xb9, 0x16, 0x57, 0xcc, 0x01, 0x0b, 0xae, 0x8e, 0x3c, 0x7c, 0x84, 0x1e,
0x06, 0xd8, 0x7b, 0x47, 0xfe, 0x6b, 0x6b, 0x70, 0xb5, 0xa7, 0x9e, 0xd8, 0x98, 0x5f, 0x79, 0xf9,
0x6e, 0x85, 0x4a, 0x50, 0x65, 0x7f, 0xff, 0x0b, 0x4c, 0xfb, 0x5a, 0xd1, 0xbf, 0x59, 0xe4, 0xf7,
0x61, 0xf6, 0x10, 0xb5, 0xb7, 0x91, 0xff, 0x0c, 0x51, 0xf3, 0x11, 0x72, 0x9d, 0x1a, 0x15, 0x05,
0x7c, 0x8a, 0x2f, 0x6f, 0x40, 0x8a, 0x50, 0x93, 0x36, 0x89, 0x38, 0x52, 0x2e, 0x46, 0x79, 0xd0,
0x91, 0x85, 0xdc, 0x23, 0xb4, 0xcf, 0x3e, 0xea, 0x62, 0x93, 0xb6, 0xc4, 0xc2, 0x96, 0x34, 0x34,
0x76, 0xe3, 0x67, 0x09, 0x66, 0xcb, 0xc4, 0xd9, 0x36, 0xc9, 0x93, 0xc0, 0xb5, 0xd0, 0x20, 0x2f,
0xfa, 0xc7, 0xb2, 0x11, 0x8a, 0x88, 0x62, 0xc9, 0x08, 0xf9, 0x2a, 0x4c, 0xf3, 0x6a, 0xf0, 0x9b,
0x5e, 0x15, 0x05, 0xcc, 0xe2, 0x09, 0x3d, 0xcb, 0x78, 0xbb, 0x8c, 0xc5, 0x9a, 0xb0, 0xd9, 0x68,
0xd4, 0xdb, 0x71, 0x13, 0x32, 0x4a, 0x53, 0x41, 0xe9, 0xb6, 0x2c, 0x36, 0xfb, 0x19, 0xe4, 0xca,
0xc4, 0xd9, 0x0d, 0xd3, 0xf5, 0x76, 0x26, 0x9f, 0x91, 0xfe, 0x45, 0xb8, 0x98, 0x90, 0x1d, 0x2b,
0x7d, 0x39, 0xc9, 0x4e, 0xb4, 0x90, 0xb9, 0xe7, 0xef, 0x55, 0x09, 0x0a, 0x8e, 0x90, 0xbd, 0xd7,
0xa4, 0x55, 0xdc, 0xf4, 0xed, 0x4a, 0xab, 0x8f, 0x0d, 0x4b, 0xc0, 0x5a, 0x98, 0xb7, 0x04, 0xcf,
0x7d, 0x3a, 0x64, 0xb0, 0x8e, 0x28, 0xc0, 0x3c, 0x16, 0xc2, 0x0c, 0x1c, 0x96, 0x5a, 0xe7, 0x4d,
0x32, 0x87, 0x4f, 0xf4, 0x54, 0xf8, 0xfe, 0x4f, 0x40, 0xed, 0xda, 0xcf, 0xbb, 0x8b, 0x17, 0x0d,
0x0f, 0xb0, 0x92, 0x80, 0x6d, 0x9e, 0x7c, 0x97, 0x3f, 0x84, 0xc5, 0x2e, 0x74, 0x78, 0x9a, 0x35,
0x09, 0xb2, 0x15, 0x60, 0xd0, 0x85, 0x04, 0x74, 0xdb, 0x24, 0x4f, 0x09, 0xb2, 0xe5, 0x63, 0xd0,
0xba, 0x60, 0xe8, 0xe0, 0x00, 0x59, 0xd4, 0x3d, 0x42, 0x4c, 0x00, 0x4f, 0x7d, 0x96, 0x5d, 0xd9,
0x05, 0x71, 0x65, 0x5f, 0x1f, 0xe2, 0xca, 0xde, 0xf1, 0xa9, 0x9e, 0x4f, 0x68, 0x7c, 0x10, 0xc9,
0x8d, 0x32, 0x2f, 0x7f, 0x36, 0x40, 0x37, 0x3f, 0x8a, 0xa7, 0x99, 0xf5, 0xbd, 0x65, 0xb1, 0x03,
0x5a, 0xc6, 0x30, 0x73, 0x64, 0xd6, 0x9b, 0xc8, 0x08, 0x78, 0xaf, 0xd8, 0xbc, 0xe8, 0x36, 0x1f,
0x8d, 0x38, 0x66, 0xfc, 0xfb, 0x6a, 0xe5, 0x62, 0xdb, 0xf4, 0xea, 0xf7, 0xb4, 0xa4, 0x38, 0x4d,
0xcf, 0x31, 0x86, 0x68, 0x45, 0xbb, 0xa3, 0x59, 0x53, 0x43, 0x34, 0xab, 0xbc, 0x02, 0x59, 0xee,
0x22, 0xab, 0x51, 0x71, 0x42, 0x02, 0x63, 0x6d, 0x85, 0x1c, 0xf9, 0x3a, 0x5c, 0xe0, 0x1b, 0xc2,
0xd3, 0x84, 0x57, 0x6f, 0x9a, 0x79, 0x9e, 0x63, 0xec, 0x0a, 0x21, 0xac, 0x72, 0x93, 0xa3, 0x47,
0x66, 0xd0, 0xe8, 0xa1, 0x5d, 0x83, 0xb5, 0x3e, 0xa5, 0x1d, 0xb7, 0xc0, 0xdf, 0xe3, 0x6c, 0xaa,
0x4a, 0xee, 0xdb, 0xf1, 0x07, 0x77, 0x40, 0xd8, 0xe4, 0xc8, 0xb7, 0x51, 0x20, 0xca, 0x5f, 0x50,
0xa1, 0x3b, 0x7c, 0x65, 0x74, 0xdd, 0xdb, 0x39, 0xce, 0xde, 0x12, 0xad, 0xaa, 0x42, 0x5a, 0x84,
0x38, 0x10, 0x97, 0x52, 0x4c, 0xcb, 0xd7, 0x60, 0x26, 0x5a, 0x8b, 0xb0, 0x4d, 0x72, 0x11, 0x11,
0x97, 0x47, 0xee, 0x64, 0xb2, 0x4c, 0xbd, 0xd5, 0x64, 0x19, 0x7a, 0xe9, 0x21, 0x42, 0x4c, 0x87,
0x87, 0x3e, 0xa3, 0x47, 0xa4, 0x7c, 0x05, 0x20, 0x0c, 0xb9, 0xe8, 0xe0, 0x0c, 0xb7, 0xd3, 0xf5,
0x45, 0xe3, 0x5e, 0x87, 0x0b, 0xae, 0x6f, 0x88, 0xcb, 0x91, 0x77, 0x2b, 0x6f, 0xb9, 0x9c, 0xeb,
0x77, 0xb6, 0x68, 0x62, 0xc2, 0xc8, 0xb2, 0x1d, 0xf1, 0x84, 0x91, 0xcc, 0xeb, 0xf4, 0xc0, 0x91,
0x72, 0x09, 0x32, 0xb4, 0x65, 0xe0, 0xc0, 0x75, 0x5c, 0x5f, 0xc9, 0x71, 0x83, 0x68, 0x6b, 0x8f,
0xd1, 0xe1, 0xf9, 0x67, 0x12, 0x82, 0xa8, 0x32, 0xc3, 0x3e, 0x70, 0x42, 0xfb, 0x3f, 0x68, 0xbd,
0x53, 0x1c, 0x57, 0xc2, 0x77, 0x12, 0xcc, 0x94, 0x89, 0xb3, 0x8f, 0xe8, 0x2e, 0xb6, 0xd1, 0x63,
0xd4, 0xee, 0x37, 0x29, 0x16, 0x21, 0xc3, 0x2f, 0xbe, 0x7d, 0x44, 0x59, 0x01, 0x64, 0x4b, 0x73,
0xf1, 0xf0, 0xd0, 0xac, 0x3e, 0x66, 0x1f, 0xf4, 0x93, 0x3d, 0xf2, 0x0d, 0x90, 0xc3, 0xfa, 0x26,
0xae, 0xe3, 0xa3, 0xc0, 0x10, 0xb3, 0x91, 0x38, 0x12, 0x67, 0x29, 0x21, 0xfb, 0xec, 0x83, 0xe0,
0x6b, 0x0a, 0x5c, 0x4a, 0x9a, 0x12, 0x59, 0x59, 0xfa, 0x2d, 0x0b, 0xe3, 0x65, 0xe2, 0xc8, 0xdf,
0x4a, 0x30, 0x77, 0x7a, 0x66, 0xba, 0x5d, 0xe8, 0xfb, 0x04, 0x2a, 0x9c, 0x35, 0x8d, 0xa8, 0x1f,
0x9f, 0x03, 0x14, 0x8f, 0x80, 0xdf, 0x48, 0x30, 0x7b, 0xea, 0xcd, 0x51, 0x1a, 0x52, 0x62, 0x07,
0x46, 0xbd, 0x37, 0x3a, 0x26, 0x36, 0xe2, 0x47, 0x09, 0x2e, 0xf5, 0x98, 0xa2, 0xee, 0x0c, 0x16,
0x7b, 0x36, 0x52, 0xfd, 0xf4, 0xbc, 0xc8, 0xd8, 0xac, 0xaf, 0x60, 0xa6, 0x6b, 0x9a, 0xba, 0x39,
0x58, 0x66, 0x12, 0xa1, 0xde, 0x19, 0x15, 0x11, 0x6b, 0x6f, 0x43, 0x2e, 0x39, 0x04, 0x15, 0x07,
0x8b, 0x4a, 0x00, 0xd4, 0x8f, 0x46, 0x04, 0xc4, 0xaa, 0x1b, 0x00, 0x1d, 0x93, 0xcc, 0x8d, 0xc1,
0x62, 0x4e, 0x76, 0xab, 0x1f, 0x8c, 0xb2, 0x3b, 0xd6, 0xf8, 0x8b, 0x04, 0x4a, 0xcf, 0x31, 0x66,
0x88, 0xd2, 0xea, 0x85, 0x55, 0x37, 0xcf, 0x8f, 0x8d, 0x8d, 0xfb, 0x49, 0x82, 0xc5, 0x5e, 0x17,
0xcc, 0xdd, 0x51, 0xe5, 0xc7, 0x50, 0xf5, 0xfe, 0xb9, 0xa1, 0x9d, 0x15, 0xda, 0xf5, 0x5c, 0x1d,
0xa2, 0x42, 0x93, 0x88, 0x61, 0x2a, 0xb4, 0xc7, 0xf3, 0x31, 0x3c, 0x3b, 0x4e, 0xbd, 0xce, 0x87,
0x38, 0x3b, 0xba, 0x31, 0xc3, 0x9c, 0x1d, 0xbd, 0x5e, 0xed, 0xf2, 0xd7, 0x70, 0xa1, 0xfb, 0x6f,
0x9e, 0x5b, 0x83, 0xc5, 0x75, 0x41, 0xd4, 0xbb, 0x23, 0x43, 0x22, 0x03, 0x36, 0x1f, 0x3f, 0x7f,
0x9d, 0x97, 0x5e, 0xbc, 0xce, 0x4b, 0x7f, 0xbd, 0xce, 0x4b, 0xdf, 0xbf, 0xc9, 0x8f, 0xbd, 0x78,
0x93, 0x1f, 0xfb, 0xe3, 0x4d, 0x7e, 0xec, 0xd9, 0xad, 0x8e, 0x7b, 0x3c, 0x14, 0xba, 0xc1, 0xff,
0xef, 0x8a, 0xe4, 0x17, 0x5b, 0xc5, 0xce, 0x7f, 0xc1, 0xc2, 0x6b, 0xbd, 0x9a, 0x62, 0xff, 0x5f,
0xdd, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x49, 0x4b, 0x22, 0xc9, 0x20, 0x13, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MsgClient interface {
AddToOutTxTracker(ctx context.Context, in *MsgAddToOutTxTracker, opts ...grpc.CallOption) (*MsgAddToOutTxTrackerResponse, error)
AddToInTxTracker(ctx context.Context, in *MsgAddToInTxTracker, opts ...grpc.CallOption) (*MsgAddToInTxTrackerResponse, error)
RemoveFromOutTxTracker(ctx context.Context, in *MsgRemoveFromOutTxTracker, opts ...grpc.CallOption) (*MsgRemoveFromOutTxTrackerResponse, error)
CreateTSSVoter(ctx context.Context, in *MsgCreateTSSVoter, opts ...grpc.CallOption) (*MsgCreateTSSVoterResponse, error)
GasPriceVoter(ctx context.Context, in *MsgGasPriceVoter, opts ...grpc.CallOption) (*MsgGasPriceVoterResponse, error)
NonceVoter(ctx context.Context, in *MsgNonceVoter, opts ...grpc.CallOption) (*MsgNonceVoterResponse, error)
VoteOnObservedOutboundTx(ctx context.Context, in *MsgVoteOnObservedOutboundTx, opts ...grpc.CallOption) (*MsgVoteOnObservedOutboundTxResponse, error)
VoteOnObservedInboundTx(ctx context.Context, in *MsgVoteOnObservedInboundTx, opts ...grpc.CallOption) (*MsgVoteOnObservedInboundTxResponse, error)
WhitelistERC20(ctx context.Context, in *MsgWhitelistERC20, opts ...grpc.CallOption) (*MsgWhitelistERC20Response, error)
UpdateTssAddress(ctx context.Context, in *MsgUpdateTssAddress, opts ...grpc.CallOption) (*MsgUpdateTssAddressResponse, error)
MigrateTssFunds(ctx context.Context, in *MsgMigrateTssFunds, opts ...grpc.CallOption) (*MsgMigrateTssFundsResponse, error)
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) AddToOutTxTracker(ctx context.Context, in *MsgAddToOutTxTracker, opts ...grpc.CallOption) (*MsgAddToOutTxTrackerResponse, error) {
out := new(MsgAddToOutTxTrackerResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/AddToOutTxTracker", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) AddToInTxTracker(ctx context.Context, in *MsgAddToInTxTracker, opts ...grpc.CallOption) (*MsgAddToInTxTrackerResponse, error) {
out := new(MsgAddToInTxTrackerResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/AddToInTxTracker", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RemoveFromOutTxTracker(ctx context.Context, in *MsgRemoveFromOutTxTracker, opts ...grpc.CallOption) (*MsgRemoveFromOutTxTrackerResponse, error) {
out := new(MsgRemoveFromOutTxTrackerResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/RemoveFromOutTxTracker", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) CreateTSSVoter(ctx context.Context, in *MsgCreateTSSVoter, opts ...grpc.CallOption) (*MsgCreateTSSVoterResponse, error) {
out := new(MsgCreateTSSVoterResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/CreateTSSVoter", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) GasPriceVoter(ctx context.Context, in *MsgGasPriceVoter, opts ...grpc.CallOption) (*MsgGasPriceVoterResponse, error) {
out := new(MsgGasPriceVoterResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/GasPriceVoter", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) NonceVoter(ctx context.Context, in *MsgNonceVoter, opts ...grpc.CallOption) (*MsgNonceVoterResponse, error) {
out := new(MsgNonceVoterResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/NonceVoter", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) VoteOnObservedOutboundTx(ctx context.Context, in *MsgVoteOnObservedOutboundTx, opts ...grpc.CallOption) (*MsgVoteOnObservedOutboundTxResponse, error) {
out := new(MsgVoteOnObservedOutboundTxResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/VoteOnObservedOutboundTx", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) VoteOnObservedInboundTx(ctx context.Context, in *MsgVoteOnObservedInboundTx, opts ...grpc.CallOption) (*MsgVoteOnObservedInboundTxResponse, error) {
out := new(MsgVoteOnObservedInboundTxResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/VoteOnObservedInboundTx", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) WhitelistERC20(ctx context.Context, in *MsgWhitelistERC20, opts ...grpc.CallOption) (*MsgWhitelistERC20Response, error) {
out := new(MsgWhitelistERC20Response)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/WhitelistERC20", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateTssAddress(ctx context.Context, in *MsgUpdateTssAddress, opts ...grpc.CallOption) (*MsgUpdateTssAddressResponse, error) {
out := new(MsgUpdateTssAddressResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/UpdateTssAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) MigrateTssFunds(ctx context.Context, in *MsgMigrateTssFunds, opts ...grpc.CallOption) (*MsgMigrateTssFundsResponse, error) {
out := new(MsgMigrateTssFundsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/MigrateTssFunds", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
AddToOutTxTracker(context.Context, *MsgAddToOutTxTracker) (*MsgAddToOutTxTrackerResponse, error)
AddToInTxTracker(context.Context, *MsgAddToInTxTracker) (*MsgAddToInTxTrackerResponse, error)
RemoveFromOutTxTracker(context.Context, *MsgRemoveFromOutTxTracker) (*MsgRemoveFromOutTxTrackerResponse, error)
CreateTSSVoter(context.Context, *MsgCreateTSSVoter) (*MsgCreateTSSVoterResponse, error)
GasPriceVoter(context.Context, *MsgGasPriceVoter) (*MsgGasPriceVoterResponse, error)
NonceVoter(context.Context, *MsgNonceVoter) (*MsgNonceVoterResponse, error)
VoteOnObservedOutboundTx(context.Context, *MsgVoteOnObservedOutboundTx) (*MsgVoteOnObservedOutboundTxResponse, error)
VoteOnObservedInboundTx(context.Context, *MsgVoteOnObservedInboundTx) (*MsgVoteOnObservedInboundTxResponse, error)
WhitelistERC20(context.Context, *MsgWhitelistERC20) (*MsgWhitelistERC20Response, error)
UpdateTssAddress(context.Context, *MsgUpdateTssAddress) (*MsgUpdateTssAddressResponse, error)
MigrateTssFunds(context.Context, *MsgMigrateTssFunds) (*MsgMigrateTssFundsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) AddToOutTxTracker(ctx context.Context, req *MsgAddToOutTxTracker) (*MsgAddToOutTxTrackerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddToOutTxTracker not implemented")
}
func (*UnimplementedMsgServer) AddToInTxTracker(ctx context.Context, req *MsgAddToInTxTracker) (*MsgAddToInTxTrackerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddToInTxTracker not implemented")
}
func (*UnimplementedMsgServer) RemoveFromOutTxTracker(ctx context.Context, req *MsgRemoveFromOutTxTracker) (*MsgRemoveFromOutTxTrackerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RemoveFromOutTxTracker not implemented")
}
func (*UnimplementedMsgServer) CreateTSSVoter(ctx context.Context, req *MsgCreateTSSVoter) (*MsgCreateTSSVoterResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateTSSVoter not implemented")
}
func (*UnimplementedMsgServer) GasPriceVoter(ctx context.Context, req *MsgGasPriceVoter) (*MsgGasPriceVoterResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GasPriceVoter not implemented")
}
func (*UnimplementedMsgServer) NonceVoter(ctx context.Context, req *MsgNonceVoter) (*MsgNonceVoterResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NonceVoter not implemented")
}
func (*UnimplementedMsgServer) VoteOnObservedOutboundTx(ctx context.Context, req *MsgVoteOnObservedOutboundTx) (*MsgVoteOnObservedOutboundTxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VoteOnObservedOutboundTx not implemented")
}
func (*UnimplementedMsgServer) VoteOnObservedInboundTx(ctx context.Context, req *MsgVoteOnObservedInboundTx) (*MsgVoteOnObservedInboundTxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VoteOnObservedInboundTx not implemented")
}
func (*UnimplementedMsgServer) WhitelistERC20(ctx context.Context, req *MsgWhitelistERC20) (*MsgWhitelistERC20Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method WhitelistERC20 not implemented")
}
func (*UnimplementedMsgServer) UpdateTssAddress(ctx context.Context, req *MsgUpdateTssAddress) (*MsgUpdateTssAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateTssAddress not implemented")
}
func (*UnimplementedMsgServer) MigrateTssFunds(ctx context.Context, req *MsgMigrateTssFunds) (*MsgMigrateTssFundsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MigrateTssFunds not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
func _Msg_AddToOutTxTracker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAddToOutTxTracker)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AddToOutTxTracker(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/AddToOutTxTracker",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AddToOutTxTracker(ctx, req.(*MsgAddToOutTxTracker))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_AddToInTxTracker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAddToInTxTracker)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AddToInTxTracker(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/AddToInTxTracker",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AddToInTxTracker(ctx, req.(*MsgAddToInTxTracker))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RemoveFromOutTxTracker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRemoveFromOutTxTracker)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RemoveFromOutTxTracker(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/RemoveFromOutTxTracker",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RemoveFromOutTxTracker(ctx, req.(*MsgRemoveFromOutTxTracker))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_CreateTSSVoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCreateTSSVoter)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CreateTSSVoter(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/CreateTSSVoter",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CreateTSSVoter(ctx, req.(*MsgCreateTSSVoter))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_GasPriceVoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgGasPriceVoter)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).GasPriceVoter(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/GasPriceVoter",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).GasPriceVoter(ctx, req.(*MsgGasPriceVoter))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_NonceVoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgNonceVoter)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).NonceVoter(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/NonceVoter",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).NonceVoter(ctx, req.(*MsgNonceVoter))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_VoteOnObservedOutboundTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgVoteOnObservedOutboundTx)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).VoteOnObservedOutboundTx(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/VoteOnObservedOutboundTx",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).VoteOnObservedOutboundTx(ctx, req.(*MsgVoteOnObservedOutboundTx))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_VoteOnObservedInboundTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgVoteOnObservedInboundTx)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).VoteOnObservedInboundTx(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/VoteOnObservedInboundTx",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).VoteOnObservedInboundTx(ctx, req.(*MsgVoteOnObservedInboundTx))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_WhitelistERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgWhitelistERC20)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).WhitelistERC20(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/WhitelistERC20",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).WhitelistERC20(ctx, req.(*MsgWhitelistERC20))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateTssAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateTssAddress)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateTssAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/UpdateTssAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateTssAddress(ctx, req.(*MsgUpdateTssAddress))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_MigrateTssFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgMigrateTssFunds)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).MigrateTssFunds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.crosschain.Msg/MigrateTssFunds",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).MigrateTssFunds(ctx, req.(*MsgMigrateTssFunds))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.crosschain.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddToOutTxTracker",
Handler: _Msg_AddToOutTxTracker_Handler,
},
{
MethodName: "AddToInTxTracker",
Handler: _Msg_AddToInTxTracker_Handler,
},
{
MethodName: "RemoveFromOutTxTracker",
Handler: _Msg_RemoveFromOutTxTracker_Handler,
},
{
MethodName: "CreateTSSVoter",
Handler: _Msg_CreateTSSVoter_Handler,
},
{
MethodName: "GasPriceVoter",
Handler: _Msg_GasPriceVoter_Handler,
},
{
MethodName: "NonceVoter",
Handler: _Msg_NonceVoter_Handler,
},
{
MethodName: "VoteOnObservedOutboundTx",
Handler: _Msg_VoteOnObservedOutboundTx_Handler,
},
{
MethodName: "VoteOnObservedInboundTx",
Handler: _Msg_VoteOnObservedInboundTx_Handler,
},
{
MethodName: "WhitelistERC20",
Handler: _Msg_WhitelistERC20_Handler,
},
{
MethodName: "UpdateTssAddress",
Handler: _Msg_UpdateTssAddress_Handler,
},
{
MethodName: "MigrateTssFunds",
Handler: _Msg_MigrateTssFunds_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "crosschain/tx.proto",
}
func (m *MsgMigrateTssFunds) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgMigrateTssFunds) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgMigrateTssFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.Amount.Size()
i -= size
if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgMigrateTssFundsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgMigrateTssFundsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgMigrateTssFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgAddToInTxTracker) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddToInTxTracker) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddToInTxTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.TxIndex != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.TxIndex))
i--
dAtA[i] = 0x38
}
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0x32
}
if m.Proof != nil {
{
size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
if m.CoinType != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x20
}
if len(m.TxHash) > 0 {
i -= len(m.TxHash)
copy(dAtA[i:], m.TxHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.TxHash)))
i--
dAtA[i] = 0x1a
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgAddToInTxTrackerResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddToInTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddToInTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgUpdateTssAddress) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateTssAddress) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateTssAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.TssPubkey) > 0 {
i -= len(m.TssPubkey)
copy(dAtA[i:], m.TssPubkey)
i = encodeVarintTx(dAtA, i, uint64(len(m.TssPubkey)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateTssAddressResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateTssAddressResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateTssAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgWhitelistERC20) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgWhitelistERC20) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgWhitelistERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.GasLimit != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.GasLimit))
i--
dAtA[i] = 0x38
}
if m.Decimals != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Decimals))
i--
dAtA[i] = 0x30
}
if len(m.Symbol) > 0 {
i -= len(m.Symbol)
copy(dAtA[i:], m.Symbol)
i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol)))
i--
dAtA[i] = 0x2a
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintTx(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x22
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x18
}
if len(m.Erc20Address) > 0 {
i -= len(m.Erc20Address)
copy(dAtA[i:], m.Erc20Address)
i = encodeVarintTx(dAtA, i, uint64(len(m.Erc20Address)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgWhitelistERC20Response) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgWhitelistERC20Response) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgWhitelistERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.CctxIndex) > 0 {
i -= len(m.CctxIndex)
copy(dAtA[i:], m.CctxIndex)
i = encodeVarintTx(dAtA, i, uint64(len(m.CctxIndex)))
i--
dAtA[i] = 0x12
}
if len(m.Zrc20Address) > 0 {
i -= len(m.Zrc20Address)
copy(dAtA[i:], m.Zrc20Address)
i = encodeVarintTx(dAtA, i, uint64(len(m.Zrc20Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgAddToOutTxTracker) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddToOutTxTracker) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddToOutTxTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.TxIndex != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.TxIndex))
i--
dAtA[i] = 0x38
}
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0x32
}
if m.Proof != nil {
{
size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
if len(m.TxHash) > 0 {
i -= len(m.TxHash)
copy(dAtA[i:], m.TxHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.TxHash)))
i--
dAtA[i] = 0x22
}
if m.Nonce != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x18
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgAddToOutTxTrackerResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddToOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddToOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgRemoveFromOutTxTracker) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgRemoveFromOutTxTracker) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgRemoveFromOutTxTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Nonce != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x18
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgRemoveFromOutTxTrackerResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgRemoveFromOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgRemoveFromOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgCreateTSSVoter) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgCreateTSSVoter) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgCreateTSSVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Status != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Status))
i--
dAtA[i] = 0x20
}
if m.KeyGenZetaHeight != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.KeyGenZetaHeight))
i--
dAtA[i] = 0x18
}
if len(m.TssPubkey) > 0 {
i -= len(m.TssPubkey)
copy(dAtA[i:], m.TssPubkey)
i = encodeVarintTx(dAtA, i, uint64(len(m.TssPubkey)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgCreateTSSVoterResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgCreateTSSVoterResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgCreateTSSVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgGasPriceVoter) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgGasPriceVoter) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgGasPriceVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Supply) > 0 {
i -= len(m.Supply)
copy(dAtA[i:], m.Supply)
i = encodeVarintTx(dAtA, i, uint64(len(m.Supply)))
i--
dAtA[i] = 0x2a
}
if m.BlockNumber != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.BlockNumber))
i--
dAtA[i] = 0x20
}
if m.Price != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Price))
i--
dAtA[i] = 0x18
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgGasPriceVoterResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgGasPriceVoterResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgGasPriceVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgNonceVoter) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgNonceVoter) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgNonceVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Nonce != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x18
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgNonceVoterResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgNonceVoterResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgNonceVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgVoteOnObservedOutboundTx) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgVoteOnObservedOutboundTx) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgVoteOnObservedOutboundTx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ObservedOutTxEffectiveGasLimit != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ObservedOutTxEffectiveGasLimit))
i--
dAtA[i] = 0x60
}
{
size := m.ObservedOutTxEffectiveGasPrice.Size()
i -= size
if _, err := m.ObservedOutTxEffectiveGasPrice.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x5a
if m.ObservedOutTxGasUsed != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ObservedOutTxGasUsed))
i--
dAtA[i] = 0x50
}
if m.CoinType != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x48
}
if m.OutTxTssNonce != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.OutTxTssNonce))
i--
dAtA[i] = 0x40
}
if m.OutTxChain != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.OutTxChain))
i--
dAtA[i] = 0x38
}
if m.Status != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Status))
i--
dAtA[i] = 0x30
}
{
size := m.ValueReceived.Size()
i -= size
if _, err := m.ValueReceived.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
if m.ObservedOutTxBlockHeight != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ObservedOutTxBlockHeight))
i--
dAtA[i] = 0x20
}
if len(m.ObservedOutTxHash) > 0 {
i -= len(m.ObservedOutTxHash)
copy(dAtA[i:], m.ObservedOutTxHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.ObservedOutTxHash)))
i--
dAtA[i] = 0x1a
}
if len(m.CctxHash) > 0 {
i -= len(m.CctxHash)
copy(dAtA[i:], m.CctxHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.CctxHash)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgVoteOnObservedOutboundTxResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgVoteOnObservedOutboundTxResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgVoteOnObservedOutboundTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgVoteOnObservedInboundTx) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgVoteOnObservedInboundTx) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgVoteOnObservedInboundTx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Asset) > 0 {
i -= len(m.Asset)
copy(dAtA[i:], m.Asset)
i = encodeVarintTx(dAtA, i, uint64(len(m.Asset)))
i--
dAtA[i] = 0x72
}
if len(m.TxOrigin) > 0 {
i -= len(m.TxOrigin)
copy(dAtA[i:], m.TxOrigin)
i = encodeVarintTx(dAtA, i, uint64(len(m.TxOrigin)))
i--
dAtA[i] = 0x6a
}
if m.CoinType != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x60
}
if m.GasLimit != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.GasLimit))
i--
dAtA[i] = 0x58
}
if m.InBlockHeight != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.InBlockHeight))
i--
dAtA[i] = 0x50
}
if len(m.InTxHash) > 0 {
i -= len(m.InTxHash)
copy(dAtA[i:], m.InTxHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.InTxHash)))
i--
dAtA[i] = 0x4a
}
if len(m.Message) > 0 {
i -= len(m.Message)
copy(dAtA[i:], m.Message)
i = encodeVarintTx(dAtA, i, uint64(len(m.Message)))
i--
dAtA[i] = 0x42
}
{
size := m.Amount.Size()
i -= size
if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if m.ReceiverChain != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ReceiverChain))
i--
dAtA[i] = 0x28
}
if len(m.Receiver) > 0 {
i -= len(m.Receiver)
copy(dAtA[i:], m.Receiver)
i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver)))
i--
dAtA[i] = 0x22
}
if m.SenderChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.SenderChainId))
i--
dAtA[i] = 0x18
}
if len(m.Sender) > 0 {
i -= len(m.Sender)
copy(dAtA[i:], m.Sender)
i = encodeVarintTx(dAtA, i, uint64(len(m.Sender)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgVoteOnObservedInboundTxResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgVoteOnObservedInboundTxResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgVoteOnObservedInboundTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgSetNodeKeys) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgSetNodeKeys) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgSetNodeKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.TssSigner_Address) > 0 {
i -= len(m.TssSigner_Address)
copy(dAtA[i:], m.TssSigner_Address)
i = encodeVarintTx(dAtA, i, uint64(len(m.TssSigner_Address)))
i--
dAtA[i] = 0x1a
}
if m.PubkeySet != nil {
{
size, err := m.PubkeySet.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgSetNodeKeysResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgSetNodeKeysResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgSetNodeKeysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *MsgMigrateTssFunds) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
l = m.Amount.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgMigrateTssFundsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgAddToInTxTracker) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
l = len(m.TxHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.CoinType != 0 {
n += 1 + sovTx(uint64(m.CoinType))
}
if m.Proof != nil {
l = m.Proof.Size()
n += 1 + l + sovTx(uint64(l))
}
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.TxIndex != 0 {
n += 1 + sovTx(uint64(m.TxIndex))
}
return n
}
func (m *MsgAddToInTxTrackerResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgUpdateTssAddress) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.TssPubkey)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateTssAddressResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgWhitelistERC20) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Erc20Address)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
l = len(m.Name)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Symbol)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.Decimals != 0 {
n += 1 + sovTx(uint64(m.Decimals))
}
if m.GasLimit != 0 {
n += 1 + sovTx(uint64(m.GasLimit))
}
return n
}
func (m *MsgWhitelistERC20Response) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Zrc20Address)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.CctxIndex)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgAddToOutTxTracker) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
if m.Nonce != 0 {
n += 1 + sovTx(uint64(m.Nonce))
}
l = len(m.TxHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.Proof != nil {
l = m.Proof.Size()
n += 1 + l + sovTx(uint64(l))
}
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.TxIndex != 0 {
n += 1 + sovTx(uint64(m.TxIndex))
}
return n
}
func (m *MsgAddToOutTxTrackerResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgRemoveFromOutTxTracker) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
if m.Nonce != 0 {
n += 1 + sovTx(uint64(m.Nonce))
}
return n
}
func (m *MsgRemoveFromOutTxTrackerResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgCreateTSSVoter) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.TssPubkey)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.KeyGenZetaHeight != 0 {
n += 1 + sovTx(uint64(m.KeyGenZetaHeight))
}
if m.Status != 0 {
n += 1 + sovTx(uint64(m.Status))
}
return n
}
func (m *MsgCreateTSSVoterResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgGasPriceVoter) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
if m.Price != 0 {
n += 1 + sovTx(uint64(m.Price))
}
if m.BlockNumber != 0 {
n += 1 + sovTx(uint64(m.BlockNumber))
}
l = len(m.Supply)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgGasPriceVoterResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgNonceVoter) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
if m.Nonce != 0 {
n += 1 + sovTx(uint64(m.Nonce))
}
return n
}
func (m *MsgNonceVoterResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgVoteOnObservedOutboundTx) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.CctxHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.ObservedOutTxHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ObservedOutTxBlockHeight != 0 {
n += 1 + sovTx(uint64(m.ObservedOutTxBlockHeight))
}
l = m.ValueReceived.Size()
n += 1 + l + sovTx(uint64(l))
if m.Status != 0 {
n += 1 + sovTx(uint64(m.Status))
}
if m.OutTxChain != 0 {
n += 1 + sovTx(uint64(m.OutTxChain))
}
if m.OutTxTssNonce != 0 {
n += 1 + sovTx(uint64(m.OutTxTssNonce))
}
if m.CoinType != 0 {
n += 1 + sovTx(uint64(m.CoinType))
}
if m.ObservedOutTxGasUsed != 0 {
n += 1 + sovTx(uint64(m.ObservedOutTxGasUsed))
}
l = m.ObservedOutTxEffectiveGasPrice.Size()
n += 1 + l + sovTx(uint64(l))
if m.ObservedOutTxEffectiveGasLimit != 0 {
n += 1 + sovTx(uint64(m.ObservedOutTxEffectiveGasLimit))
}
return n
}
func (m *MsgVoteOnObservedOutboundTxResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgVoteOnObservedInboundTx) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Sender)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.SenderChainId != 0 {
n += 1 + sovTx(uint64(m.SenderChainId))
}
l = len(m.Receiver)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ReceiverChain != 0 {
n += 1 + sovTx(uint64(m.ReceiverChain))
}
l = m.Amount.Size()
n += 1 + l + sovTx(uint64(l))
l = len(m.Message)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.InTxHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.InBlockHeight != 0 {
n += 1 + sovTx(uint64(m.InBlockHeight))
}
if m.GasLimit != 0 {
n += 1 + sovTx(uint64(m.GasLimit))
}
if m.CoinType != 0 {
n += 1 + sovTx(uint64(m.CoinType))
}
l = len(m.TxOrigin)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Asset)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgVoteOnObservedInboundTxResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgSetNodeKeys) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.PubkeySet != nil {
l = m.PubkeySet.Size()
n += 1 + l + sovTx(uint64(l))
}
l = len(m.TssSigner_Address)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgSetNodeKeysResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgMigrateTssFunds: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgMigrateTssFunds: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgMigrateTssFundsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgMigrateTssFundsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgMigrateTssFundsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddToInTxTracker: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddToInTxTracker: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Proof == nil {
m.Proof = &common.Proof{}
}
if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType)
}
m.TxIndex = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.TxIndex |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddToInTxTrackerResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddToInTxTrackerResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddToInTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateTssAddress) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateTssAddress: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateTssAddress: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssPubkey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateTssAddressResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateTssAddressResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateTssAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgWhitelistERC20: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgWhitelistERC20: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Erc20Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Erc20Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Symbol = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType)
}
m.Decimals = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Decimals |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
m.GasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasLimit |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgWhitelistERC20Response) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgWhitelistERC20Response: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgWhitelistERC20Response: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Zrc20Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddToOutTxTracker: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddToOutTxTracker: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Proof == nil {
m.Proof = &common.Proof{}
}
if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType)
}
m.TxIndex = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.TxIndex |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddToOutTxTrackerResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddToOutTxTrackerResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddToOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgRemoveFromOutTxTracker) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgRemoveFromOutTxTracker: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgRemoveFromOutTxTracker: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgRemoveFromOutTxTrackerResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgRemoveFromOutTxTrackerResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgRemoveFromOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgCreateTSSVoter: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgCreateTSSVoter: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssPubkey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field KeyGenZetaHeight", wireType)
}
m.KeyGenZetaHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.KeyGenZetaHeight |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
m.Status = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Status |= common.ReceiveStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgCreateTSSVoterResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgCreateTSSVoterResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgCreateTSSVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgGasPriceVoter) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgGasPriceVoter: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgGasPriceVoter: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType)
}
m.Price = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Price |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType)
}
m.BlockNumber = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BlockNumber |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Supply = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgGasPriceVoterResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgGasPriceVoterResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgGasPriceVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgNonceVoter) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgNonceVoter: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgNonceVoter: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgNonceVoterResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgNonceVoterResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgNonceVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgVoteOnObservedOutboundTx: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgVoteOnObservedOutboundTx: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CctxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CctxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservedOutTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObservedOutTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservedOutTxBlockHeight", wireType)
}
m.ObservedOutTxBlockHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ObservedOutTxBlockHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ValueReceived.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
m.Status = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Status |= common.ReceiveStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutTxChain", wireType)
}
m.OutTxChain = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutTxChain |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutTxTssNonce", wireType)
}
m.OutTxTssNonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutTxTssNonce |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 10:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservedOutTxGasUsed", wireType)
}
m.ObservedOutTxGasUsed = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ObservedOutTxGasUsed |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservedOutTxEffectiveGasPrice", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ObservedOutTxEffectiveGasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 12:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservedOutTxEffectiveGasLimit", wireType)
}
m.ObservedOutTxEffectiveGasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ObservedOutTxEffectiveGasLimit |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgVoteOnObservedOutboundTxResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgVoteOnObservedOutboundTxResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgVoteOnObservedOutboundTxResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgVoteOnObservedInboundTx) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgVoteOnObservedInboundTx: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgVoteOnObservedInboundTx: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Sender = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field SenderChainId", wireType)
}
m.SenderChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.SenderChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Receiver = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ReceiverChain", wireType)
}
m.ReceiverChain = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ReceiverChain |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Message = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InTxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field InBlockHeight", wireType)
}
m.InBlockHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.InBlockHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 11:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
m.GasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasLimit |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 12:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxOrigin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxOrigin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 14:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Asset = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgVoteOnObservedInboundTxResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgVoteOnObservedInboundTxResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgVoteOnObservedInboundTxResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgSetNodeKeys) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgSetNodeKeys: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgSetNodeKeys: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PubkeySet", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.PubkeySet == nil {
m.PubkeySet = &common.PubKeySet{}
}
if err := m.PubkeySet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssSigner_Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssSigner_Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgSetNodeKeysResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgSetNodeKeysResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgSetNodeKeysResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
package emissions
import (
"sort"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/x/emissions/keeper"
"github.com/zeta-chain/zetacore/x/emissions/types"
)
func BeginBlocker(ctx sdk.Context, keeper keeper.Keeper) {
reservesFactor, bondFactor, durationFactor := keeper.GetBlockRewardComponents(ctx)
blockRewards := reservesFactor.Mul(bondFactor).Mul(durationFactor)
if blockRewards.IsZero() {
return
}
validatorRewards := sdk.MustNewDecFromStr(keeper.GetParams(ctx).ValidatorEmissionPercentage).Mul(blockRewards).TruncateInt()
observerRewards := sdk.MustNewDecFromStr(keeper.GetParams(ctx).ObserverEmissionPercentage).Mul(blockRewards).TruncateInt()
tssSignerRewards := sdk.MustNewDecFromStr(keeper.GetParams(ctx).TssSignerEmissionPercentage).Mul(blockRewards).TruncateInt()
err := DistributeValidatorRewards(ctx, validatorRewards, keeper.GetBankKeeper(), keeper.GetFeeCollector())
if err != nil {
panic(err)
}
err = DistributeObserverRewards(ctx, observerRewards, keeper)
if err != nil {
panic(err)
}
err = DistributeTssRewards(ctx, tssSignerRewards, keeper.GetBankKeeper())
if err != nil {
panic(err)
}
types.EmitValidatorEmissions(ctx, bondFactor.String(), reservesFactor.String(),
durationFactor.String(),
validatorRewards.String(),
observerRewards.String(),
tssSignerRewards.String())
}
// DistributeValidatorRewards distributes the rewards to validators who signed the block .
// The block proposer gets a bonus reward
// This function uses the distribution module of cosmos-sdk , by directly sending funds to the feecollector.
func DistributeValidatorRewards(ctx sdk.Context, amount sdkmath.Int, bankKeeper types.BankKeeper, feeCollector string) error {
coin := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, amount))
return bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, feeCollector, coin)
}
// DistributeObserverRewards distributes the rewards to all observers who voted in any of the matured ballots
// The total rewards are distributed equally among all Successful votes
// NotVoted or Unsuccessful votes are slashed
// rewards given or slashed amounts are in azeta
func DistributeObserverRewards(ctx sdk.Context, amount sdkmath.Int, keeper keeper.Keeper) error {
rewardsDistributer := map[string]int64{}
totalRewardsUnits := int64(0)
err := keeper.GetBankKeeper().SendCoinsFromModuleToModule(ctx, types.ModuleName, types.UndistributedObserverRewardsPool, sdk.NewCoins(sdk.NewCoin(config.BaseDenom, amount)))
if err != nil {
return err
}
ballotIdentifiers := keeper.GetObserverKeeper().GetMaturedBallotList(ctx)
// do not distribute rewards if no ballots are matured, the rewards can accumulate in the undistributed pool
if len(ballotIdentifiers) == 0 {
return nil
}
for _, ballotIdentifier := range ballotIdentifiers {
ballot, found := keeper.GetObserverKeeper().GetBallot(ctx, ballotIdentifier)
if !found {
continue
}
totalRewardsUnits += ballot.BuildRewardsDistribution(rewardsDistributer)
}
rewardPerUnit := sdkmath.ZeroInt()
if totalRewardsUnits > 0 && amount.IsPositive() {
rewardPerUnit = amount.Quo(sdk.NewInt(totalRewardsUnits))
}
sortedKeys := make([]string, 0, len(rewardsDistributer))
for k := range rewardsDistributer {
sortedKeys = append(sortedKeys, k)
}
sort.Strings(sortedKeys)
var finalDistributionList []*types.ObserverEmission
for _, key := range sortedKeys {
observerAddress, err := sdk.AccAddressFromBech32(key)
if err != nil {
ctx.Logger().Error("Error while parsing observer address ", "error", err, "address", key)
continue
}
// observerRewardUnits can be negative if the observer has been slashed
// an observers earn 1 unit for a correct vote, and -1 unit for an incorrect vote
observerRewardUnits := rewardsDistributer[key]
if observerRewardUnits == 0 {
finalDistributionList = append(finalDistributionList, &types.ObserverEmission{
EmissionType: types.EmissionType_Slash,
ObserverAddress: observerAddress.String(),
Amount: sdkmath.ZeroInt(),
})
continue
}
if observerRewardUnits < 0 {
slashAmount := keeper.GetParams(ctx).ObserverSlashAmount
keeper.SlashObserverEmission(ctx, observerAddress.String(), slashAmount)
finalDistributionList = append(finalDistributionList, &types.ObserverEmission{
EmissionType: types.EmissionType_Slash,
ObserverAddress: observerAddress.String(),
Amount: slashAmount,
})
continue
}
// Defensive check
if rewardPerUnit.GT(sdk.ZeroInt()) {
rewardAmount := rewardPerUnit.Mul(sdkmath.NewInt(observerRewardUnits))
keeper.AddObserverEmission(ctx, observerAddress.String(), rewardAmount)
finalDistributionList = append(finalDistributionList, &types.ObserverEmission{
EmissionType: types.EmissionType_Rewards,
ObserverAddress: observerAddress.String(),
Amount: rewardAmount,
})
}
}
types.EmitObserverEmissions(ctx, finalDistributionList)
// TODO : Delete Ballots after distribution
// https://github.com/zeta-chain/node/issues/942
return nil
}
// DistributeTssRewards trasferes the allocated rewards to the Undistributed Tss Rewards Pool.
// This is done so that the reserves factor is properly calculated in the next block
func DistributeTssRewards(ctx sdk.Context, amount sdk.Int, bankKeeper types.BankKeeper) error {
coin := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, amount))
return bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.UndistributedTssRewardsPool, coin)
}
package querytests
import (
"math/rand"
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcfg "github.com/evmos/ethermint/cmd/config"
"github.com/stretchr/testify/suite"
"github.com/zeta-chain/zetacore/app"
cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/testutil/network"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
type CliTestSuite struct {
suite.Suite
cfg network.Config
network *network.Network
ballots []*observerTypes.Ballot
}
func NewCLITestSuite(cfg network.Config) *CliTestSuite {
return &CliTestSuite{cfg: cfg}
}
func (s *CliTestSuite) Setconfig() {
config := sdk.GetConfig()
cmdcfg.SetBech32Prefixes(config)
ethcfg.SetBip44CoinType(config)
// Make sure address is compatible with ethereum
config.SetAddressVerifier(app.VerifyAddressFormat)
config.Seal()
}
func (s *CliTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")
s.Setconfig()
minOBsDel, ok := sdk.NewIntFromString("100000000000000000000")
s.Require().True(ok)
s.cfg.StakingTokens = minOBsDel.Mul(sdk.NewInt(int64(10)))
s.cfg.BondedTokens = minOBsDel
observerList := []string{"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax",
"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2",
"zeta1szrskhdeleyt6wmn0nfxvcvt2l6f4fn06uaga4",
"zeta16h3y7s7030l4chcznwq3n6uz2m9wvmzu5vwt7c",
"zeta1xl2rfsrmx8nxryty3lsjuxwdxs59cn2q65e5ca",
"zeta1ktmprjdvc72jq0mpu8tn8sqx9xwj685qx0q6kt",
"zeta1ygeyr8pqfjvclxay5234gulnjzv2mkz6lph9y4",
"zeta1zegyenj7xg5nck04ykkzndm2qxdzc6v83mklsy",
"zeta1us2qpqdcctk6q7qv2c9d9jvjxlv88jscf68kav",
"zeta1e9fyaulgntkrnqnl0es4nyxghp3petpn2ntu3t",
}
network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false)
s.ballots = RandomBallotGenerator(20, observerList)
network.AddObserverData(s.T(), s.cfg.GenesisState, s.cfg.Codec, s.ballots)
net, err := network.New(s.T(), app.NodeDir, s.cfg)
s.Assert().NoError(err)
s.network = net
_, err = s.network.WaitForHeight(1)
s.Require().NoError(err)
}
func CreateRandomVoteList(numberOfVotes int) []observerTypes.VoteType {
voteOptions := []observerTypes.VoteType{observerTypes.VoteType_SuccessObservation, observerTypes.VoteType_FailureObservation, observerTypes.VoteType_NotYetVoted}
min := 0
max := len(voteOptions) - 1
voteList := make([]observerTypes.VoteType, numberOfVotes)
for i := 0; i < numberOfVotes; i++ {
voteList[i] = voteOptions[rand.Intn(max-min)+min] // #nosec G404
}
return voteList
}
func RandomBallotGenerator(numberOfBallots int, voterList []string) []*observerTypes.Ballot {
ballots := make([]*observerTypes.Ballot, numberOfBallots)
ballotStatus := []observerTypes.BallotStatus{observerTypes.BallotStatus_BallotFinalized_FailureObservation, observerTypes.BallotStatus_BallotFinalized_SuccessObservation}
min := 0
max := len(ballotStatus) - 1
// #nosec G404 randomness is not a security issue here
for i := 0; i < numberOfBallots; i++ {
ballots[i] = &observerTypes.Ballot{
Index: "",
BallotIdentifier: "TestBallot" + strconv.Itoa(i),
VoterList: voterList,
Votes: CreateRandomVoteList(len(voterList)),
ObservationType: observerTypes.ObservationType_InBoundTx,
BallotThreshold: sdk.MustNewDecFromStr("0.66"),
// #nosec G404 randomness used for testing
BallotStatus: ballotStatus[rand.Intn(max-min)+min],
BallotCreationHeight: 0,
}
}
return ballots
}
func (s *CliTestSuite) TearDownSuite() {
s.T().Log("tearing down genesis test suite")
s.network.Cleanup()
}
package emissions
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/emissions/keeper"
"github.com/zeta-chain/zetacore/x/emissions/types"
)
// InitGenesis initializes the emissions module's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
k.SetParams(ctx, genState.Params)
for _, we := range genState.WithdrawableEmissions {
k.SetWithdrawableEmission(ctx, we)
}
}
// ExportGenesis returns the emissions module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
var genesis types.GenesisState
genesis.Params = k.GetParams(ctx)
genesis.WithdrawableEmissions = k.GetAllWithdrawableEmission(ctx)
return &genesis
}
package emissions
import (
"context"
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/emissions/client/cli"
emissionskeeper "github.com/zeta-chain/zetacore/x/emissions/keeper"
"github.com/zeta-chain/zetacore/x/emissions/types"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
)
// ----------------------------------------------------------------------------
// AppModuleBasic
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the emissions module.
type AppModuleBasic struct {
cdc codec.BinaryCodec
}
func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic {
return AppModuleBasic{cdc: cdc}
}
// Name returns the emissions module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
}
func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
// RegisterInterfaces registers the module's interface types
func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}
// DefaultGenesis returns the emissions module's default genesis state.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesis())
}
// ValidateGenesis performs genesis state validation for the emissions module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return genState.Validate()
}
// RegisterRESTRoutes registers the emissions module's REST service handlers.
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {
fmt.Println("RegisterQueryHandlerClient err: %w", err)
}
}
// GetTxCmd returns the emissions module's root tx command.
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}
// GetQueryCmd returns the emissions module's root query command.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(types.StoreKey)
}
// ----------------------------------------------------------------------------
// AppModule
// ----------------------------------------------------------------------------
// AppModule implements the AppModule interface for the emissions module.
type AppModule struct {
AppModuleBasic
keeper emissionskeeper.Keeper
accountKeeper types.AccountKeeper
}
func NewAppModule(
cdc codec.Codec,
keeper emissionskeeper.Keeper,
accountKeeper types.AccountKeeper,
) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
accountKeeper: accountKeeper,
}
}
// Name returns the emissions module's name.
func (am AppModule) Name() string {
return am.AppModuleBasic.Name()
}
// Route returns the emissions module's message routing key.
func (am AppModule) Route() sdk.Route {
return sdk.Route{}
}
// QuerierRoute returns the emissions module's query routing key.
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
// LegacyQuerierHandler returns the emissions module's Querier.
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), emissionskeeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
}
// RegisterInvariants registers the emissions module's invariants.
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// InitGenesis performs the emissions module's genesis initialization It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate {
var genState types.GenesisState
// Initialize global index to index in genesis state
cdc.MustUnmarshalJSON(gs, &genState)
InitGenesis(ctx, am.keeper, genState)
am.accountKeeper.GetModuleAccount(ctx, types.ModuleName)
am.accountKeeper.GetModuleAccount(ctx, types.UndistributedTssRewardsPool)
am.accountKeeper.GetModuleAccount(ctx, types.UndistributedObserverRewardsPool)
return []abci.ValidatorUpdate{}
}
// ExportGenesis returns the emissions module's exported genesis state as raw JSON bytes.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
genState := ExportGenesis(ctx, am.keeper)
return cdc.MustMarshalJSON(genState)
}
// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 2 }
// BeginBlock executes all ABCI BeginBlock logic respective to the emissions module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
BeginBlocker(ctx, am.keeper)
}
// EndBlock executes all ABCI EndBlock logic respective to the emissions module. It
// returns no validator updates.
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
func RegisterCodec(_ *codec.LegacyAmino) {
}
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
var (
Amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
)
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
func EmitValidatorEmissions(ctx sdk.Context, bondFactor, reservesFactor, durationsFactor, validatorRewards, observerRewards, tssRewards string) {
err := ctx.EventManager().EmitTypedEvents(&EventBlockEmissions{
MsgTypeUrl: "/zetachain.zetacore.emissions.internal.BlockEmissions",
BondFactor: bondFactor,
DurationFactor: durationsFactor,
ReservesFactor: reservesFactor,
ValidatorRewardsForBlock: validatorRewards,
ObserverRewardsForBlock: observerRewards,
TssRewardsForBlock: tssRewards,
})
if err != nil {
ctx.Logger().Error("Error emitting ValidatorEmissions :", err)
}
}
func EmitObserverEmissions(ctx sdk.Context, em []*ObserverEmission) {
err := ctx.EventManager().EmitTypedEvents(&EventObserverEmissions{
MsgTypeUrl: "/zetachain.zetacore.emissions.internal.ObserverEmissions",
Emissions: em,
})
if err != nil {
ctx.Logger().Error("Error emitting ObserverEmissions :", err)
}
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: emissions/events.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type EmissionType int32
const (
EmissionType_Slash EmissionType = 0
EmissionType_Rewards EmissionType = 1
)
var EmissionType_name = map[int32]string{
0: "Slash",
1: "Rewards",
}
var EmissionType_value = map[string]int32{
"Slash": 0,
"Rewards": 1,
}
func (x EmissionType) String() string {
return proto.EnumName(EmissionType_name, int32(x))
}
func (EmissionType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_ff510015c00ef7ae, []int{0}
}
type ObserverEmission struct {
EmissionType EmissionType `protobuf:"varint,1,opt,name=emission_type,json=emissionType,proto3,enum=zetachain.zetacore.emissions.EmissionType" json:"emission_type,omitempty"`
ObserverAddress string `protobuf:"bytes,2,opt,name=observer_address,json=observerAddress,proto3" json:"observer_address,omitempty"`
Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"`
}
func (m *ObserverEmission) Reset() { *m = ObserverEmission{} }
func (m *ObserverEmission) String() string { return proto.CompactTextString(m) }
func (*ObserverEmission) ProtoMessage() {}
func (*ObserverEmission) Descriptor() ([]byte, []int) {
return fileDescriptor_ff510015c00ef7ae, []int{0}
}
func (m *ObserverEmission) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ObserverEmission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ObserverEmission.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ObserverEmission) XXX_Merge(src proto.Message) {
xxx_messageInfo_ObserverEmission.Merge(m, src)
}
func (m *ObserverEmission) XXX_Size() int {
return m.Size()
}
func (m *ObserverEmission) XXX_DiscardUnknown() {
xxx_messageInfo_ObserverEmission.DiscardUnknown(m)
}
var xxx_messageInfo_ObserverEmission proto.InternalMessageInfo
func (m *ObserverEmission) GetEmissionType() EmissionType {
if m != nil {
return m.EmissionType
}
return EmissionType_Slash
}
func (m *ObserverEmission) GetObserverAddress() string {
if m != nil {
return m.ObserverAddress
}
return ""
}
type EventObserverEmissions struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
Emissions []*ObserverEmission `protobuf:"bytes,2,rep,name=emissions,proto3" json:"emissions,omitempty"`
}
func (m *EventObserverEmissions) Reset() { *m = EventObserverEmissions{} }
func (m *EventObserverEmissions) String() string { return proto.CompactTextString(m) }
func (*EventObserverEmissions) ProtoMessage() {}
func (*EventObserverEmissions) Descriptor() ([]byte, []int) {
return fileDescriptor_ff510015c00ef7ae, []int{1}
}
func (m *EventObserverEmissions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventObserverEmissions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventObserverEmissions.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventObserverEmissions) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventObserverEmissions.Merge(m, src)
}
func (m *EventObserverEmissions) XXX_Size() int {
return m.Size()
}
func (m *EventObserverEmissions) XXX_DiscardUnknown() {
xxx_messageInfo_EventObserverEmissions.DiscardUnknown(m)
}
var xxx_messageInfo_EventObserverEmissions proto.InternalMessageInfo
func (m *EventObserverEmissions) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventObserverEmissions) GetEmissions() []*ObserverEmission {
if m != nil {
return m.Emissions
}
return nil
}
type EventBlockEmissions struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
BondFactor string `protobuf:"bytes,2,opt,name=bond_factor,json=bondFactor,proto3" json:"bond_factor,omitempty"`
ReservesFactor string `protobuf:"bytes,3,opt,name=reserves_factor,json=reservesFactor,proto3" json:"reserves_factor,omitempty"`
DurationFactor string `protobuf:"bytes,4,opt,name=duration_factor,json=durationFactor,proto3" json:"duration_factor,omitempty"`
ValidatorRewardsForBlock string `protobuf:"bytes,5,opt,name=validator_rewards_for_block,json=validatorRewardsForBlock,proto3" json:"validator_rewards_for_block,omitempty"`
ObserverRewardsForBlock string `protobuf:"bytes,6,opt,name=observer_rewards_for_block,json=observerRewardsForBlock,proto3" json:"observer_rewards_for_block,omitempty"`
TssRewardsForBlock string `protobuf:"bytes,7,opt,name=tss_rewards_for_block,json=tssRewardsForBlock,proto3" json:"tss_rewards_for_block,omitempty"`
}
func (m *EventBlockEmissions) Reset() { *m = EventBlockEmissions{} }
func (m *EventBlockEmissions) String() string { return proto.CompactTextString(m) }
func (*EventBlockEmissions) ProtoMessage() {}
func (*EventBlockEmissions) Descriptor() ([]byte, []int) {
return fileDescriptor_ff510015c00ef7ae, []int{2}
}
func (m *EventBlockEmissions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventBlockEmissions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventBlockEmissions.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventBlockEmissions) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventBlockEmissions.Merge(m, src)
}
func (m *EventBlockEmissions) XXX_Size() int {
return m.Size()
}
func (m *EventBlockEmissions) XXX_DiscardUnknown() {
xxx_messageInfo_EventBlockEmissions.DiscardUnknown(m)
}
var xxx_messageInfo_EventBlockEmissions proto.InternalMessageInfo
func (m *EventBlockEmissions) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventBlockEmissions) GetBondFactor() string {
if m != nil {
return m.BondFactor
}
return ""
}
func (m *EventBlockEmissions) GetReservesFactor() string {
if m != nil {
return m.ReservesFactor
}
return ""
}
func (m *EventBlockEmissions) GetDurationFactor() string {
if m != nil {
return m.DurationFactor
}
return ""
}
func (m *EventBlockEmissions) GetValidatorRewardsForBlock() string {
if m != nil {
return m.ValidatorRewardsForBlock
}
return ""
}
func (m *EventBlockEmissions) GetObserverRewardsForBlock() string {
if m != nil {
return m.ObserverRewardsForBlock
}
return ""
}
func (m *EventBlockEmissions) GetTssRewardsForBlock() string {
if m != nil {
return m.TssRewardsForBlock
}
return ""
}
func init() {
proto.RegisterEnum("zetachain.zetacore.emissions.EmissionType", EmissionType_name, EmissionType_value)
proto.RegisterType((*ObserverEmission)(nil), "zetachain.zetacore.emissions.ObserverEmission")
proto.RegisterType((*EventObserverEmissions)(nil), "zetachain.zetacore.emissions.EventObserverEmissions")
proto.RegisterType((*EventBlockEmissions)(nil), "zetachain.zetacore.emissions.EventBlockEmissions")
}
func init() { proto.RegisterFile("emissions/events.proto", fileDescriptor_ff510015c00ef7ae) }
var fileDescriptor_ff510015c00ef7ae = []byte{
// 494 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xc1, 0x6e, 0xd3, 0x40,
0x10, 0x86, 0xbd, 0x69, 0x9b, 0x2a, 0x93, 0xd0, 0x46, 0x0b, 0x14, 0x2b, 0x20, 0x27, 0xca, 0x01,
0x42, 0x45, 0x6d, 0x28, 0x47, 0xc4, 0x81, 0x48, 0x8d, 0x04, 0x42, 0xaa, 0x64, 0xe0, 0xc2, 0xc5,
0x5a, 0xdb, 0x5b, 0xc7, 0xaa, 0xed, 0x8d, 0x76, 0x36, 0x81, 0xf2, 0x04, 0x1c, 0x79, 0x08, 0x0e,
0x3c, 0x4a, 0x8f, 0x3d, 0x21, 0xe0, 0x50, 0xa1, 0xe4, 0x45, 0x90, 0x37, 0x76, 0x12, 0x05, 0x14,
0x89, 0x53, 0x36, 0xbf, 0xbe, 0xdf, 0x33, 0xff, 0xce, 0x2c, 0x1c, 0xf0, 0x34, 0x46, 0x8c, 0x45,
0x86, 0x0e, 0x9f, 0xf0, 0x4c, 0xa1, 0x3d, 0x92, 0x42, 0x09, 0x7a, 0xef, 0x13, 0x57, 0x2c, 0x18,
0xb2, 0x38, 0xb3, 0xf5, 0x49, 0x48, 0x6e, 0x2f, 0xd0, 0xd6, 0xad, 0x48, 0x44, 0x42, 0x83, 0x4e,
0x7e, 0x9a, 0x7b, 0xba, 0xdf, 0x09, 0x34, 0x4f, 0x7d, 0xe4, 0x72, 0xc2, 0xe5, 0x49, 0xc1, 0xd2,
0x53, 0xb8, 0x51, 0xfa, 0x3c, 0x75, 0x31, 0xe2, 0x26, 0xe9, 0x90, 0xde, 0xde, 0xf1, 0xa1, 0xbd,
0xa9, 0x80, 0x5d, 0xda, 0xdf, 0x5e, 0x8c, 0xb8, 0xdb, 0xe0, 0x2b, 0xff, 0xe8, 0x43, 0x68, 0x8a,
0xa2, 0x88, 0xc7, 0xc2, 0x50, 0x72, 0x44, 0xb3, 0xd2, 0x21, 0xbd, 0x9a, 0xbb, 0x5f, 0xea, 0x2f,
0xe6, 0x32, 0x1d, 0x40, 0x95, 0xa5, 0x62, 0x9c, 0x29, 0x73, 0x2b, 0x07, 0xfa, 0xf6, 0xe5, 0x75,
0xdb, 0xf8, 0x75, 0xdd, 0xbe, 0x1f, 0xc5, 0x6a, 0x38, 0xf6, 0xed, 0x40, 0xa4, 0x4e, 0x20, 0x30,
0x15, 0x58, 0xfc, 0x1c, 0x61, 0x78, 0xee, 0xe4, 0x5d, 0xa2, 0xfd, 0x32, 0x53, 0x6e, 0xe1, 0xee,
0x7e, 0x26, 0x70, 0x70, 0x92, 0xdf, 0xce, 0x7a, 0x3a, 0xa4, 0x1d, 0x68, 0xa4, 0x18, 0xe9, 0x64,
0xde, 0x58, 0x26, 0x3a, 0x5d, 0xcd, 0x85, 0x14, 0xa3, 0xbc, 0xd9, 0x77, 0x32, 0xa1, 0xaf, 0xa1,
0xb6, 0xc8, 0x65, 0x56, 0x3a, 0x5b, 0xbd, 0xfa, 0xb1, 0xbd, 0x39, 0xfc, 0x7a, 0x15, 0x77, 0xf9,
0x81, 0xee, 0xcf, 0x0a, 0xdc, 0xd4, 0xad, 0xf4, 0x13, 0x11, 0x9c, 0xff, 0x4f, 0x1f, 0x6d, 0xa8,
0xfb, 0x22, 0x0b, 0xbd, 0x33, 0x16, 0x28, 0x21, 0x8b, 0x2b, 0x83, 0x5c, 0x1a, 0x68, 0x85, 0x3e,
0x80, 0x7d, 0xc9, 0x75, 0x65, 0x2c, 0x21, 0x7d, 0x6d, 0xee, 0x5e, 0x29, 0x2f, 0xc1, 0x70, 0x2c,
0x99, 0xca, 0x47, 0x5a, 0x80, 0xdb, 0x73, 0xb0, 0x94, 0x0b, 0xf0, 0x39, 0xdc, 0x9d, 0xb0, 0x24,
0x0e, 0x99, 0x12, 0xd2, 0x93, 0xfc, 0x03, 0x93, 0x21, 0x7a, 0x67, 0x42, 0x7a, 0x7e, 0xde, 0xbc,
0xb9, 0xa3, 0x4d, 0xe6, 0x02, 0x71, 0xe7, 0xc4, 0x40, 0x48, 0x1d, 0x8e, 0x3e, 0x83, 0xd6, 0x62,
0xd2, 0x7f, 0xbb, 0xab, 0xda, 0x7d, 0xa7, 0x24, 0xd6, 0xcd, 0x4f, 0xe0, 0xb6, 0x42, 0xfc, 0x87,
0x6f, 0x57, 0xfb, 0xa8, 0x42, 0x5c, 0xb3, 0x1c, 0x3e, 0x82, 0xc6, 0xea, 0xde, 0xd1, 0x1a, 0xec,
0xbc, 0x49, 0x18, 0x0e, 0x9b, 0x06, 0xad, 0xc3, 0x6e, 0x41, 0x37, 0x49, 0x6b, 0xfb, 0xdb, 0x57,
0x8b, 0xf4, 0x5f, 0x5d, 0x4e, 0x2d, 0x72, 0x35, 0xb5, 0xc8, 0xef, 0xa9, 0x45, 0xbe, 0xcc, 0x2c,
0xe3, 0x6a, 0x66, 0x19, 0x3f, 0x66, 0x96, 0xf1, 0xfe, 0xf1, 0xca, 0x7a, 0xe5, 0xe3, 0x3d, 0xd2,
0x93, 0x76, 0xca, 0x49, 0x3b, 0x1f, 0x9d, 0xe5, 0xa3, 0xd3, 0xcb, 0xe6, 0x57, 0xf5, 0x03, 0x7a,
0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x8d, 0x2d, 0x0d, 0x8e, 0x03, 0x00, 0x00,
}
func (m *ObserverEmission) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ObserverEmission) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ObserverEmission) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.Amount.Size()
i -= size
if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintEvents(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if len(m.ObserverAddress) > 0 {
i -= len(m.ObserverAddress)
copy(dAtA[i:], m.ObserverAddress)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ObserverAddress)))
i--
dAtA[i] = 0x12
}
if m.EmissionType != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.EmissionType))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *EventObserverEmissions) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventObserverEmissions) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventObserverEmissions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Emissions) > 0 {
for iNdEx := len(m.Emissions) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Emissions[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventBlockEmissions) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventBlockEmissions) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventBlockEmissions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.TssRewardsForBlock) > 0 {
i -= len(m.TssRewardsForBlock)
copy(dAtA[i:], m.TssRewardsForBlock)
i = encodeVarintEvents(dAtA, i, uint64(len(m.TssRewardsForBlock)))
i--
dAtA[i] = 0x3a
}
if len(m.ObserverRewardsForBlock) > 0 {
i -= len(m.ObserverRewardsForBlock)
copy(dAtA[i:], m.ObserverRewardsForBlock)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ObserverRewardsForBlock)))
i--
dAtA[i] = 0x32
}
if len(m.ValidatorRewardsForBlock) > 0 {
i -= len(m.ValidatorRewardsForBlock)
copy(dAtA[i:], m.ValidatorRewardsForBlock)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ValidatorRewardsForBlock)))
i--
dAtA[i] = 0x2a
}
if len(m.DurationFactor) > 0 {
i -= len(m.DurationFactor)
copy(dAtA[i:], m.DurationFactor)
i = encodeVarintEvents(dAtA, i, uint64(len(m.DurationFactor)))
i--
dAtA[i] = 0x22
}
if len(m.ReservesFactor) > 0 {
i -= len(m.ReservesFactor)
copy(dAtA[i:], m.ReservesFactor)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ReservesFactor)))
i--
dAtA[i] = 0x1a
}
if len(m.BondFactor) > 0 {
i -= len(m.BondFactor)
copy(dAtA[i:], m.BondFactor)
i = encodeVarintEvents(dAtA, i, uint64(len(m.BondFactor)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
offset -= sovEvents(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *ObserverEmission) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.EmissionType != 0 {
n += 1 + sovEvents(uint64(m.EmissionType))
}
l = len(m.ObserverAddress)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = m.Amount.Size()
n += 1 + l + sovEvents(uint64(l))
return n
}
func (m *EventObserverEmissions) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if len(m.Emissions) > 0 {
for _, e := range m.Emissions {
l = e.Size()
n += 1 + l + sovEvents(uint64(l))
}
}
return n
}
func (m *EventBlockEmissions) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.BondFactor)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ReservesFactor)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.DurationFactor)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ValidatorRewardsForBlock)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ObserverRewardsForBlock)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.TssRewardsForBlock)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func sovEvents(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozEvents(x uint64) (n int) {
return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *ObserverEmission) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ObserverEmission: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ObserverEmission: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field EmissionType", wireType)
}
m.EmissionType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.EmissionType |= EmissionType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventObserverEmissions) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventObserverEmissions: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventObserverEmissions: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Emissions", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Emissions = append(m.Emissions, &ObserverEmission{})
if err := m.Emissions[len(m.Emissions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventBlockEmissions) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventBlockEmissions: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventBlockEmissions: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BondFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BondFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ReservesFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ReservesFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DurationFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DurationFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorRewardsForBlock", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValidatorRewardsForBlock = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverRewardsForBlock", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverRewardsForBlock = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssRewardsForBlock", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssRewardsForBlock = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEvents(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthEvents
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEvents
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
package types
// DefaultIndex is the default emissions global index
const DefaultIndex uint64 = 1
// DefaultGenesis returns the default emissions genesis state
func DefaultGenesis() *GenesisState {
return &GenesisState{
Params: DefaultParams(),
}
}
// Validate performs basic genesis state validation returning an error upon any
// failure.
func (gs GenesisState) Validate() error {
return gs.Params.Validate()
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: emissions/genesis.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the emissions module's genesis state.
type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
WithdrawableEmissions []WithdrawableEmissions `protobuf:"bytes,2,rep,name=withdrawableEmissions,proto3" json:"withdrawableEmissions"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_e8737d2c94e4152f, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
func (m *GenesisState) GetWithdrawableEmissions() []WithdrawableEmissions {
if m != nil {
return m.WithdrawableEmissions
}
return nil
}
func init() {
proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.emissions.GenesisState")
}
func init() { proto.RegisterFile("emissions/genesis.proto", fileDescriptor_e8737d2c94e4152f) }
var fileDescriptor_e8737d2c94e4152f = []byte{
// 248 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xcd, 0xcd, 0x2c,
0x2e, 0xce, 0xcc, 0xcf, 0x2b, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28,
0xca, 0x2f, 0xc9, 0x17, 0x92, 0xa9, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03,
0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0xe0, 0x6a, 0xa5, 0xc4, 0x10, 0xda, 0x0a, 0x12, 0x8b, 0x12, 0x73,
0xa1, 0xba, 0xa4, 0xd4, 0x10, 0xe2, 0xe5, 0x99, 0x25, 0x19, 0x29, 0x45, 0x89, 0xe5, 0x89, 0x49,
0x39, 0xa9, 0xf1, 0x70, 0x61, 0xa8, 0x3a, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4,
0x82, 0x88, 0x2a, 0x1d, 0x66, 0xe4, 0xe2, 0x71, 0x87, 0xb8, 0x22, 0xb8, 0x24, 0xb1, 0x24, 0x55,
0xc8, 0x89, 0x8b, 0x0d, 0x62, 0xbc, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x8a, 0x1e, 0x3e,
0x57, 0xe9, 0x05, 0x80, 0xd5, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0xd5, 0x29, 0x94,
0xcf, 0x25, 0x8a, 0xec, 0x14, 0x57, 0x98, 0x6a, 0x09, 0x26, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x63,
0xfc, 0x46, 0x86, 0x63, 0xd3, 0x0a, 0xb5, 0x01, 0xbb, 0xb9, 0x4e, 0x5e, 0x27, 0x1e, 0xc9, 0x31,
0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb,
0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c,
0x9f, 0xab, 0x0f, 0xb2, 0x4b, 0x17, 0x6c, 0xad, 0x3e, 0xcc, 0x5a, 0xfd, 0x0a, 0x7d, 0x44, 0xf0,
0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x03, 0xc6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff,
0x0c, 0xa5, 0xaf, 0x46, 0xa7, 0x01, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.WithdrawableEmissions) > 0 {
for iNdEx := len(m.WithdrawableEmissions) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.WithdrawableEmissions[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
if len(m.WithdrawableEmissions) > 0 {
for _, e := range m.WithdrawableEmissions {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WithdrawableEmissions", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.WithdrawableEmissions = append(m.WithdrawableEmissions, WithdrawableEmissions{})
if err := m.WithdrawableEmissions[len(m.WithdrawableEmissions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
const (
// ModuleName defines the module name
ModuleName = "emissions"
UndistributedObserverRewardsPool = ModuleName + "Observers"
UndistributedTssRewardsPool = ModuleName + "Tss"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey is the message route for slashing
RouterKey = ModuleName
// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_emissions"
WithdrawableEmissionsKey = "WithdrawableEmissions-value-"
SecsInMonth = 30 * 24 * 60 * 60
)
func KeyPrefix(p string) []byte {
return []byte(p)
}
const (
EmissionsTrackerKey = "EmissionsTracker-value-"
ParamMaxBondFactor = "MaxBondFactor"
ParamMinBondFactor = "MinBondFactor"
ParamAvgBlockTime = "AvgBlockTime"
ParamTargetBondRatio = "TargetBondRation"
ParamValidatorEmissionPercentage = "ValidatorEmissionPercentage"
ParamObserverEmissionPercentage = "ObserverEmissionPercentage"
ParamTssSignerEmissionPercentage = "SignerEmissionPercentage"
ParamDurationFactorConstant = "DurationFactorConstant"
)
var (
EmissionsModuleAddress = authtypes.NewModuleAddress(ModuleName)
UndistributedObserverRewardsPoolAddress = authtypes.NewModuleAddress(UndistributedObserverRewardsPool)
UndistributedTssRewardsPoolAddress = authtypes.NewModuleAddress(UndistributedTssRewardsPool)
)
package types
import (
"fmt"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"gopkg.in/yaml.v2"
)
var _ paramtypes.ParamSet = (*Params)(nil)
// ParamKeyTable the param key table for launch module
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}
// NewParams creates a new Params instance
func NewParams() Params {
defaultSlashAmount := sdk.ZeroInt()
intSlashAmount, ok := sdkmath.NewIntFromString("100000000000000000")
if ok {
defaultSlashAmount = intSlashAmount
}
return Params{
MaxBondFactor: "1.25",
MinBondFactor: "0.75",
AvgBlockTime: "6.00",
TargetBondRatio: "00.67",
ValidatorEmissionPercentage: "00.50",
ObserverEmissionPercentage: "00.25",
TssSignerEmissionPercentage: "00.25",
DurationFactorConstant: "0.001877876953694702",
ObserverSlashAmount: defaultSlashAmount,
}
}
// DefaultParams returns a default set of parameters
func DefaultParams() Params {
return NewParams()
}
// ParamSetPairs get the params.ParamSet
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(KeyPrefix(ParamMaxBondFactor), &p.MaxBondFactor, validateMaxBondFactor),
paramtypes.NewParamSetPair(KeyPrefix(ParamMinBondFactor), &p.MinBondFactor, validateMinBondFactor),
paramtypes.NewParamSetPair(KeyPrefix(ParamAvgBlockTime), &p.AvgBlockTime, validateAvgBlockTime),
paramtypes.NewParamSetPair(KeyPrefix(ParamTargetBondRatio), &p.TargetBondRatio, validateTargetBondRatio),
paramtypes.NewParamSetPair(KeyPrefix(ParamValidatorEmissionPercentage), &p.ValidatorEmissionPercentage, validateValidatorEmissonPercentage),
paramtypes.NewParamSetPair(KeyPrefix(ParamObserverEmissionPercentage), &p.ObserverEmissionPercentage, validateObserverEmissonPercentage),
paramtypes.NewParamSetPair(KeyPrefix(ParamTssSignerEmissionPercentage), &p.TssSignerEmissionPercentage, validateTssEmissonPercentage),
paramtypes.NewParamSetPair(KeyPrefix(ParamDurationFactorConstant), &p.DurationFactorConstant, validateDurationFactorConstant),
}
}
// Validate validates the set of params
func (p Params) Validate() error {
return nil
}
// String implements the Stringer interface.
func (p Params) String() string {
out, err := yaml.Marshal(p)
if err != nil {
return ""
}
return string(out)
}
func validateDurationFactorConstant(i interface{}) error {
_, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}
func validateMaxBondFactor(i interface{}) error {
v, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
decMaxBond := sdk.MustNewDecFromStr(v)
if decMaxBond.GT(sdk.MustNewDecFromStr("1.25")) {
return fmt.Errorf("max bond factor cannot be higher that 0.25")
}
return nil
}
func validateMinBondFactor(i interface{}) error {
v, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
decMaxBond := sdk.MustNewDecFromStr(v)
if decMaxBond.LT(sdk.MustNewDecFromStr("0.75")) {
return fmt.Errorf("min bond factor cannot be lower that 0.75")
}
return nil
}
func validateAvgBlockTime(i interface{}) error {
_, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}
func validateTargetBondRatio(i interface{}) error {
v, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
decMaxBond := sdk.MustNewDecFromStr(v)
if decMaxBond.GT(sdk.MustNewDecFromStr("100.00")) {
return fmt.Errorf("target bond ratio cannot be more than 100 percent")
}
if decMaxBond.LT(sdk.ZeroDec()) {
return fmt.Errorf("target bond ratio cannot be less than 0 percent")
}
return nil
}
func validateValidatorEmissonPercentage(i interface{}) error {
v, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
dec := sdk.MustNewDecFromStr(v)
if dec.GT(sdk.MustNewDecFromStr("100.00")) {
return fmt.Errorf("validator emission percentage cannot be more than 100 percent")
}
if dec.LT(sdk.ZeroDec()) {
return fmt.Errorf("validator emission percentage cannot be less than 0 percent")
}
return nil
}
func validateObserverEmissonPercentage(i interface{}) error {
v, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
dec := sdk.MustNewDecFromStr(v)
if dec.GT(sdk.MustNewDecFromStr("100.00")) {
return fmt.Errorf("observer emission percentage cannot be more than 100 percent")
}
if dec.LT(sdk.ZeroDec()) {
return fmt.Errorf("observer emission percentage cannot be less than 0 percent")
}
return nil
}
func validateTssEmissonPercentage(i interface{}) error {
v, ok := i.(string)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
dec := sdk.MustNewDecFromStr(v)
if dec.GT(sdk.MustNewDecFromStr("100.00")) {
return fmt.Errorf("tss emission percentage cannot be more than 100 percent")
}
if dec.LT(sdk.ZeroDec()) {
return fmt.Errorf("tss emission percentage cannot be less than 0 percent")
}
return nil
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: emissions/params.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the parameters for the module.
type Params struct {
MaxBondFactor string `protobuf:"bytes,1,opt,name=max_bond_factor,json=maxBondFactor,proto3" json:"max_bond_factor,omitempty"`
MinBondFactor string `protobuf:"bytes,2,opt,name=min_bond_factor,json=minBondFactor,proto3" json:"min_bond_factor,omitempty"`
AvgBlockTime string `protobuf:"bytes,3,opt,name=avg_block_time,json=avgBlockTime,proto3" json:"avg_block_time,omitempty"`
TargetBondRatio string `protobuf:"bytes,4,opt,name=target_bond_ratio,json=targetBondRatio,proto3" json:"target_bond_ratio,omitempty"`
ValidatorEmissionPercentage string `protobuf:"bytes,5,opt,name=validator_emission_percentage,json=validatorEmissionPercentage,proto3" json:"validator_emission_percentage,omitempty"`
ObserverEmissionPercentage string `protobuf:"bytes,6,opt,name=observer_emission_percentage,json=observerEmissionPercentage,proto3" json:"observer_emission_percentage,omitempty"`
TssSignerEmissionPercentage string `protobuf:"bytes,7,opt,name=tss_signer_emission_percentage,json=tssSignerEmissionPercentage,proto3" json:"tss_signer_emission_percentage,omitempty"`
DurationFactorConstant string `protobuf:"bytes,8,opt,name=duration_factor_constant,json=durationFactorConstant,proto3" json:"duration_factor_constant,omitempty"`
ObserverSlashAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=observer_slash_amount,json=observerSlashAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"observer_slash_amount"`
}
func (m *Params) Reset() { *m = Params{} }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_74b1fd2414ebb64a, []int{0}
}
func (m *Params) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Params) XXX_Merge(src proto.Message) {
xxx_messageInfo_Params.Merge(m, src)
}
func (m *Params) XXX_Size() int {
return m.Size()
}
func (m *Params) XXX_DiscardUnknown() {
xxx_messageInfo_Params.DiscardUnknown(m)
}
var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetMaxBondFactor() string {
if m != nil {
return m.MaxBondFactor
}
return ""
}
func (m *Params) GetMinBondFactor() string {
if m != nil {
return m.MinBondFactor
}
return ""
}
func (m *Params) GetAvgBlockTime() string {
if m != nil {
return m.AvgBlockTime
}
return ""
}
func (m *Params) GetTargetBondRatio() string {
if m != nil {
return m.TargetBondRatio
}
return ""
}
func (m *Params) GetValidatorEmissionPercentage() string {
if m != nil {
return m.ValidatorEmissionPercentage
}
return ""
}
func (m *Params) GetObserverEmissionPercentage() string {
if m != nil {
return m.ObserverEmissionPercentage
}
return ""
}
func (m *Params) GetTssSignerEmissionPercentage() string {
if m != nil {
return m.TssSignerEmissionPercentage
}
return ""
}
func (m *Params) GetDurationFactorConstant() string {
if m != nil {
return m.DurationFactorConstant
}
return ""
}
func init() {
proto.RegisterType((*Params)(nil), "zetachain.zetacore.emissions.Params")
}
func init() { proto.RegisterFile("emissions/params.proto", fileDescriptor_74b1fd2414ebb64a) }
var fileDescriptor_74b1fd2414ebb64a = []byte{
// 429 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x6b, 0xd4, 0x40,
0x14, 0xc7, 0x37, 0xba, 0xae, 0x76, 0x50, 0x8b, 0x51, 0x4b, 0xa8, 0x35, 0x2b, 0x22, 0x45, 0x84,
0x26, 0x82, 0x17, 0xf1, 0xa4, 0x29, 0x0a, 0x7a, 0x2a, 0x5b, 0x4f, 0x5e, 0x86, 0x97, 0x64, 0xcc,
0x0e, 0xdd, 0x99, 0xb7, 0xcc, 0x7b, 0xbb, 0xac, 0x7e, 0x0a, 0x8f, 0x7a, 0xf3, 0xe3, 0xf4, 0xd8,
0xa3, 0x78, 0x28, 0xb2, 0xfb, 0x45, 0x24, 0x93, 0x64, 0xad, 0xb0, 0x3d, 0x65, 0x78, 0xef, 0xf7,
0x7e, 0x99, 0x37, 0xfc, 0xc5, 0x8e, 0x32, 0x9a, 0x48, 0xa3, 0xa5, 0x74, 0x0a, 0x0e, 0x0c, 0x25,
0x53, 0x87, 0x8c, 0xe1, 0xde, 0x57, 0xc5, 0x50, 0x8c, 0x41, 0xdb, 0xc4, 0x9f, 0xd0, 0xa9, 0x64,
0x8d, 0xee, 0xde, 0xab, 0xb0, 0x42, 0x0f, 0xa6, 0xf5, 0xa9, 0x99, 0x79, 0xfc, 0xa3, 0x2f, 0x06,
0x47, 0x5e, 0x12, 0xee, 0x8b, 0x6d, 0x03, 0x0b, 0x99, 0xa3, 0x2d, 0xe5, 0x67, 0x28, 0x18, 0x5d,
0x14, 0x3c, 0x0a, 0x9e, 0x6e, 0x8d, 0x6e, 0x19, 0x58, 0x64, 0x68, 0xcb, 0x77, 0xbe, 0xe8, 0x39,
0x6d, 0xff, 0xe3, 0xae, 0xb4, 0x9c, 0xb6, 0x17, 0xb8, 0x27, 0xe2, 0x36, 0xcc, 0x2b, 0x99, 0x4f,
0xb0, 0x38, 0x91, 0xac, 0x8d, 0x8a, 0xae, 0x7a, 0xec, 0x26, 0xcc, 0xab, 0xac, 0x2e, 0x7e, 0xd4,
0x46, 0x85, 0xcf, 0xc4, 0x1d, 0x06, 0x57, 0x29, 0x6e, 0x84, 0x0e, 0x58, 0x63, 0xd4, 0xf7, 0xe0,
0x76, 0xd3, 0xa8, 0x95, 0xa3, 0xba, 0x1c, 0x66, 0xe2, 0xe1, 0x1c, 0x26, 0xba, 0x04, 0x46, 0x27,
0xbb, 0xcd, 0xe4, 0x54, 0xb9, 0x42, 0x59, 0x86, 0x4a, 0x45, 0xd7, 0xfc, 0xdc, 0x83, 0x35, 0xf4,
0xb6, 0x65, 0x8e, 0xd6, 0x48, 0xf8, 0x5a, 0xec, 0x61, 0x4e, 0xca, 0xcd, 0xd5, 0x66, 0xc5, 0xc0,
0x2b, 0x76, 0x3b, 0x66, 0x83, 0xe1, 0x50, 0xc4, 0x4c, 0x24, 0x49, 0x57, 0xf6, 0x12, 0xc7, 0xf5,
0xe6, 0x1a, 0x4c, 0x74, 0xec, 0xa1, 0x0d, 0x92, 0x97, 0x22, 0x2a, 0x67, 0x7e, 0x59, 0xdb, 0x3e,
0xa2, 0x2c, 0xd0, 0x12, 0x83, 0xe5, 0xe8, 0x86, 0x1f, 0xdf, 0xe9, 0xfa, 0xcd, 0x73, 0x1e, 0xb6,
0xdd, 0x30, 0x17, 0xf7, 0xd7, 0x0b, 0xd0, 0x04, 0x68, 0x2c, 0xc1, 0xe0, 0xcc, 0x72, 0xb4, 0x55,
0x8f, 0x65, 0xc9, 0xe9, 0xf9, 0xb0, 0xf7, 0xfb, 0x7c, 0xb8, 0x5f, 0x69, 0x1e, 0xcf, 0xf2, 0xa4,
0x40, 0x93, 0x16, 0x48, 0x06, 0xa9, 0xfd, 0x1c, 0x50, 0x79, 0x92, 0xf2, 0x97, 0xa9, 0xa2, 0xe4,
0xbd, 0xe5, 0xd1, 0xdd, 0x4e, 0x76, 0x5c, 0xbb, 0xde, 0x78, 0xd5, 0xab, 0xfe, 0xf7, 0x9f, 0xc3,
0x5e, 0xf6, 0xe1, 0x74, 0x19, 0x07, 0x67, 0xcb, 0x38, 0xf8, 0xb3, 0x8c, 0x83, 0x6f, 0xab, 0xb8,
0x77, 0xb6, 0x8a, 0x7b, 0xbf, 0x56, 0x71, 0xef, 0xd3, 0xf3, 0x0b, 0xf2, 0x3a, 0x6a, 0x07, 0x3e,
0x75, 0x69, 0x97, 0xba, 0x74, 0x91, 0xfe, 0x8b, 0xa8, 0xff, 0x55, 0x3e, 0xf0, 0x71, 0x7b, 0xf1,
0x37, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x51, 0x64, 0x07, 0xbc, 0x02, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.ObserverSlashAmount.Size()
i -= size
if _, err := m.ObserverSlashAmount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x4a
if len(m.DurationFactorConstant) > 0 {
i -= len(m.DurationFactorConstant)
copy(dAtA[i:], m.DurationFactorConstant)
i = encodeVarintParams(dAtA, i, uint64(len(m.DurationFactorConstant)))
i--
dAtA[i] = 0x42
}
if len(m.TssSignerEmissionPercentage) > 0 {
i -= len(m.TssSignerEmissionPercentage)
copy(dAtA[i:], m.TssSignerEmissionPercentage)
i = encodeVarintParams(dAtA, i, uint64(len(m.TssSignerEmissionPercentage)))
i--
dAtA[i] = 0x3a
}
if len(m.ObserverEmissionPercentage) > 0 {
i -= len(m.ObserverEmissionPercentage)
copy(dAtA[i:], m.ObserverEmissionPercentage)
i = encodeVarintParams(dAtA, i, uint64(len(m.ObserverEmissionPercentage)))
i--
dAtA[i] = 0x32
}
if len(m.ValidatorEmissionPercentage) > 0 {
i -= len(m.ValidatorEmissionPercentage)
copy(dAtA[i:], m.ValidatorEmissionPercentage)
i = encodeVarintParams(dAtA, i, uint64(len(m.ValidatorEmissionPercentage)))
i--
dAtA[i] = 0x2a
}
if len(m.TargetBondRatio) > 0 {
i -= len(m.TargetBondRatio)
copy(dAtA[i:], m.TargetBondRatio)
i = encodeVarintParams(dAtA, i, uint64(len(m.TargetBondRatio)))
i--
dAtA[i] = 0x22
}
if len(m.AvgBlockTime) > 0 {
i -= len(m.AvgBlockTime)
copy(dAtA[i:], m.AvgBlockTime)
i = encodeVarintParams(dAtA, i, uint64(len(m.AvgBlockTime)))
i--
dAtA[i] = 0x1a
}
if len(m.MinBondFactor) > 0 {
i -= len(m.MinBondFactor)
copy(dAtA[i:], m.MinBondFactor)
i = encodeVarintParams(dAtA, i, uint64(len(m.MinBondFactor)))
i--
dAtA[i] = 0x12
}
if len(m.MaxBondFactor) > 0 {
i -= len(m.MaxBondFactor)
copy(dAtA[i:], m.MaxBondFactor)
i = encodeVarintParams(dAtA, i, uint64(len(m.MaxBondFactor)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintParams(dAtA []byte, offset int, v uint64) int {
offset -= sovParams(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Params) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MaxBondFactor)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.MinBondFactor)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.AvgBlockTime)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.TargetBondRatio)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.ValidatorEmissionPercentage)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.ObserverEmissionPercentage)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.TssSignerEmissionPercentage)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.DurationFactorConstant)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = m.ObserverSlashAmount.Size()
n += 1 + l + sovParams(uint64(l))
return n
}
func sovParams(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozParams(x uint64) (n int) {
return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Params) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Params: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxBondFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MaxBondFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinBondFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MinBondFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AvgBlockTime", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AvgBlockTime = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TargetBondRatio", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TargetBondRatio = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorEmissionPercentage", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValidatorEmissionPercentage = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverEmissionPercentage", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverEmissionPercentage = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TssSignerEmissionPercentage", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TssSignerEmissionPercentage = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DurationFactorConstant", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DurationFactorConstant = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverSlashAmount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ObserverSlashAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipParams(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthParams
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupParams
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthParams
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowParams = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: emissions/query.proto
package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// QueryParamsRequest is request type for the Query/Params RPC method.
type QueryParamsRequest struct {
}
func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{0}
}
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsRequest.Merge(m, src)
}
func (m *QueryParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo
// QueryParamsResponse is response type for the Query/Params RPC method.
type QueryParamsResponse struct {
// params holds all the parameters of this module.
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{1}
}
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsResponse.Merge(m, src)
}
func (m *QueryParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo
func (m *QueryParamsResponse) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
type QueryListPoolAddressesRequest struct {
}
func (m *QueryListPoolAddressesRequest) Reset() { *m = QueryListPoolAddressesRequest{} }
func (m *QueryListPoolAddressesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryListPoolAddressesRequest) ProtoMessage() {}
func (*QueryListPoolAddressesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{2}
}
func (m *QueryListPoolAddressesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryListPoolAddressesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryListPoolAddressesRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryListPoolAddressesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryListPoolAddressesRequest.Merge(m, src)
}
func (m *QueryListPoolAddressesRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryListPoolAddressesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryListPoolAddressesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryListPoolAddressesRequest proto.InternalMessageInfo
type QueryListPoolAddressesResponse struct {
UndistributedObserverBalancesAddress string `protobuf:"bytes,1,opt,name=undistributed_observer_balances_address,json=undistributedObserverBalancesAddress,proto3" json:"undistributed_observer_balances_address,omitempty"`
UndistributedTssBalancesAddress string `protobuf:"bytes,2,opt,name=undistributed_tss_balances_address,json=undistributedTssBalancesAddress,proto3" json:"undistributed_tss_balances_address,omitempty"`
EmissionModuleAddress string `protobuf:"bytes,3,opt,name=emission_module_address,json=emissionModuleAddress,proto3" json:"emission_module_address,omitempty"`
}
func (m *QueryListPoolAddressesResponse) Reset() { *m = QueryListPoolAddressesResponse{} }
func (m *QueryListPoolAddressesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryListPoolAddressesResponse) ProtoMessage() {}
func (*QueryListPoolAddressesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{3}
}
func (m *QueryListPoolAddressesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryListPoolAddressesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryListPoolAddressesResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryListPoolAddressesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryListPoolAddressesResponse.Merge(m, src)
}
func (m *QueryListPoolAddressesResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryListPoolAddressesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryListPoolAddressesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryListPoolAddressesResponse proto.InternalMessageInfo
func (m *QueryListPoolAddressesResponse) GetUndistributedObserverBalancesAddress() string {
if m != nil {
return m.UndistributedObserverBalancesAddress
}
return ""
}
func (m *QueryListPoolAddressesResponse) GetUndistributedTssBalancesAddress() string {
if m != nil {
return m.UndistributedTssBalancesAddress
}
return ""
}
func (m *QueryListPoolAddressesResponse) GetEmissionModuleAddress() string {
if m != nil {
return m.EmissionModuleAddress
}
return ""
}
type QueryGetEmissionsFactorsRequest struct {
}
func (m *QueryGetEmissionsFactorsRequest) Reset() { *m = QueryGetEmissionsFactorsRequest{} }
func (m *QueryGetEmissionsFactorsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetEmissionsFactorsRequest) ProtoMessage() {}
func (*QueryGetEmissionsFactorsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{4}
}
func (m *QueryGetEmissionsFactorsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetEmissionsFactorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetEmissionsFactorsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetEmissionsFactorsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetEmissionsFactorsRequest.Merge(m, src)
}
func (m *QueryGetEmissionsFactorsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetEmissionsFactorsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetEmissionsFactorsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetEmissionsFactorsRequest proto.InternalMessageInfo
type QueryGetEmissionsFactorsResponse struct {
ReservesFactor string `protobuf:"bytes,1,opt,name=reservesFactor,proto3" json:"reservesFactor,omitempty"`
BondFactor string `protobuf:"bytes,2,opt,name=bondFactor,proto3" json:"bondFactor,omitempty"`
DurationFactor string `protobuf:"bytes,3,opt,name=durationFactor,proto3" json:"durationFactor,omitempty"`
}
func (m *QueryGetEmissionsFactorsResponse) Reset() { *m = QueryGetEmissionsFactorsResponse{} }
func (m *QueryGetEmissionsFactorsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetEmissionsFactorsResponse) ProtoMessage() {}
func (*QueryGetEmissionsFactorsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{5}
}
func (m *QueryGetEmissionsFactorsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetEmissionsFactorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetEmissionsFactorsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetEmissionsFactorsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetEmissionsFactorsResponse.Merge(m, src)
}
func (m *QueryGetEmissionsFactorsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetEmissionsFactorsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetEmissionsFactorsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetEmissionsFactorsResponse proto.InternalMessageInfo
func (m *QueryGetEmissionsFactorsResponse) GetReservesFactor() string {
if m != nil {
return m.ReservesFactor
}
return ""
}
func (m *QueryGetEmissionsFactorsResponse) GetBondFactor() string {
if m != nil {
return m.BondFactor
}
return ""
}
func (m *QueryGetEmissionsFactorsResponse) GetDurationFactor() string {
if m != nil {
return m.DurationFactor
}
return ""
}
type QueryShowAvailableEmissionsRequest struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
}
func (m *QueryShowAvailableEmissionsRequest) Reset() { *m = QueryShowAvailableEmissionsRequest{} }
func (m *QueryShowAvailableEmissionsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryShowAvailableEmissionsRequest) ProtoMessage() {}
func (*QueryShowAvailableEmissionsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{6}
}
func (m *QueryShowAvailableEmissionsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryShowAvailableEmissionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryShowAvailableEmissionsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryShowAvailableEmissionsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryShowAvailableEmissionsRequest.Merge(m, src)
}
func (m *QueryShowAvailableEmissionsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryShowAvailableEmissionsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryShowAvailableEmissionsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryShowAvailableEmissionsRequest proto.InternalMessageInfo
func (m *QueryShowAvailableEmissionsRequest) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
type QueryShowAvailableEmissionsResponse struct {
Amount string `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"`
}
func (m *QueryShowAvailableEmissionsResponse) Reset() { *m = QueryShowAvailableEmissionsResponse{} }
func (m *QueryShowAvailableEmissionsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryShowAvailableEmissionsResponse) ProtoMessage() {}
func (*QueryShowAvailableEmissionsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_6e578782beb6ef82, []int{7}
}
func (m *QueryShowAvailableEmissionsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryShowAvailableEmissionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryShowAvailableEmissionsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryShowAvailableEmissionsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryShowAvailableEmissionsResponse.Merge(m, src)
}
func (m *QueryShowAvailableEmissionsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryShowAvailableEmissionsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryShowAvailableEmissionsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryShowAvailableEmissionsResponse proto.InternalMessageInfo
func (m *QueryShowAvailableEmissionsResponse) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.emissions.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.emissions.QueryParamsResponse")
proto.RegisterType((*QueryListPoolAddressesRequest)(nil), "zetachain.zetacore.emissions.QueryListPoolAddressesRequest")
proto.RegisterType((*QueryListPoolAddressesResponse)(nil), "zetachain.zetacore.emissions.QueryListPoolAddressesResponse")
proto.RegisterType((*QueryGetEmissionsFactorsRequest)(nil), "zetachain.zetacore.emissions.QueryGetEmissionsFactorsRequest")
proto.RegisterType((*QueryGetEmissionsFactorsResponse)(nil), "zetachain.zetacore.emissions.QueryGetEmissionsFactorsResponse")
proto.RegisterType((*QueryShowAvailableEmissionsRequest)(nil), "zetachain.zetacore.emissions.QueryShowAvailableEmissionsRequest")
proto.RegisterType((*QueryShowAvailableEmissionsResponse)(nil), "zetachain.zetacore.emissions.QueryShowAvailableEmissionsResponse")
}
func init() { proto.RegisterFile("emissions/query.proto", fileDescriptor_6e578782beb6ef82) }
var fileDescriptor_6e578782beb6ef82 = []byte{
// 654 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6b, 0xd4, 0x40,
0x18, 0xde, 0x54, 0x5d, 0x71, 0x04, 0xc1, 0x69, 0xad, 0x25, 0xd4, 0x6c, 0x8d, 0x4b, 0x15, 0xb5,
0x49, 0x3f, 0x40, 0x44, 0x6d, 0x69, 0x17, 0x54, 0xf0, 0x03, 0x6b, 0xd5, 0x83, 0x5e, 0xc2, 0x64,
0x33, 0x66, 0x07, 0x92, 0x4c, 0x9a, 0x77, 0xd2, 0x5a, 0xc5, 0x8b, 0x47, 0x4f, 0x62, 0xff, 0x8e,
0x3f, 0xa0, 0xde, 0x0a, 0x5e, 0x3c, 0xa9, 0x74, 0xfd, 0x19, 0x1e, 0x64, 0x27, 0x93, 0x74, 0xbf,
0x59, 0xeb, 0x6d, 0xe6, 0xcd, 0xfb, 0x3c, 0xef, 0xf3, 0xbc, 0x79, 0x42, 0xd0, 0x39, 0x1a, 0x32,
0x00, 0xc6, 0x23, 0xb0, 0x37, 0x53, 0x9a, 0xec, 0x58, 0x71, 0xc2, 0x05, 0xc7, 0xd3, 0x6f, 0xa9,
0x20, 0xf5, 0x06, 0x61, 0x91, 0x25, 0x4f, 0x3c, 0xa1, 0x56, 0xd1, 0xa9, 0x5f, 0xad, 0x73, 0x08,
0x39, 0xd8, 0x2e, 0x01, 0x9a, 0xc1, 0xec, 0xad, 0x05, 0x97, 0x0a, 0xb2, 0x60, 0xc7, 0xc4, 0x67,
0x11, 0x11, 0x8c, 0x47, 0x19, 0x93, 0x3e, 0x79, 0x38, 0x20, 0x26, 0x09, 0x09, 0x41, 0xd5, 0x27,
0x7c, 0xee, 0x73, 0x79, 0xb4, 0x5b, 0x27, 0x55, 0x9d, 0xf6, 0x39, 0xf7, 0x03, 0x6a, 0x93, 0x98,
0xd9, 0x24, 0x8a, 0xb8, 0x90, 0x54, 0x0a, 0x63, 0x4e, 0x20, 0xfc, 0xb4, 0x35, 0x6d, 0x5d, 0x12,
0x6d, 0xd0, 0xcd, 0x94, 0x82, 0x30, 0x5f, 0xa2, 0xf1, 0x8e, 0x2a, 0xc4, 0x3c, 0x02, 0x8a, 0x6b,
0xa8, 0x9c, 0x0d, 0x9c, 0xd2, 0x66, 0xb4, 0x2b, 0xa7, 0x17, 0xab, 0xd6, 0x30, 0x4f, 0x56, 0x86,
0xae, 0x1d, 0xdf, 0xfb, 0x51, 0x29, 0x6d, 0x28, 0xa4, 0x59, 0x41, 0x17, 0x24, 0xf5, 0x23, 0x06,
0x62, 0x9d, 0xf3, 0x60, 0xcd, 0xf3, 0x12, 0x0a, 0x40, 0x8b, 0xd9, 0x7f, 0x34, 0x64, 0x0c, 0xea,
0x50, 0x3a, 0x5e, 0xa0, 0xcb, 0x69, 0xe4, 0x31, 0x10, 0x09, 0x73, 0x53, 0x41, 0x3d, 0x87, 0xbb,
0x40, 0x93, 0x2d, 0x9a, 0x38, 0x2e, 0x09, 0x48, 0x54, 0xa7, 0xe0, 0x90, 0x0c, 0x24, 0x85, 0x9e,
0xda, 0xa8, 0x76, 0xb4, 0x3f, 0x51, 0xdd, 0x35, 0xd5, 0xac, 0x06, 0xe0, 0x87, 0xc8, 0xec, 0xa4,
0x15, 0x00, 0xbd, 0x8c, 0x63, 0x92, 0xb1, 0xd2, 0xd1, 0xf9, 0x1c, 0xa0, 0x9b, 0xec, 0x06, 0x3a,
0x9f, 0x6f, 0xc2, 0x09, 0xb9, 0x97, 0x06, 0xb4, 0x60, 0x38, 0x26, 0x19, 0x8a, 0x98, 0x3c, 0x96,
0x4f, 0x15, 0xce, 0xbc, 0x88, 0x2a, 0xd2, 0xfd, 0x7d, 0x2a, 0xee, 0xe6, 0x9b, 0xbc, 0x47, 0xea,
0x82, 0x27, 0xc5, 0x86, 0x3e, 0x6b, 0x68, 0x66, 0x70, 0x8f, 0xda, 0xd1, 0x2c, 0x3a, 0x93, 0x50,
0xe9, 0x53, 0x3d, 0x52, 0xab, 0xe8, 0xaa, 0x62, 0x03, 0x21, 0x97, 0x47, 0x9e, 0xea, 0xc9, 0xcc,
0xb5, 0x55, 0x5a, 0x3c, 0x5e, 0x9a, 0xc8, 0xcc, 0xa8, 0x9e, 0x4c, 0x7e, 0x57, 0xd5, 0x5c, 0x41,
0xa6, 0xd4, 0xf4, 0xac, 0xc1, 0xb7, 0xd7, 0xb6, 0x08, 0x0b, 0x88, 0x1b, 0xd0, 0x42, 0x9d, 0x92,
0x8e, 0xa7, 0xd0, 0xc9, 0xce, 0x37, 0x93, 0x5f, 0xcd, 0x65, 0x74, 0x69, 0x28, 0x5e, 0xd9, 0x9a,
0x44, 0x65, 0x12, 0xf2, 0x34, 0x12, 0x0a, 0xaf, 0x6e, 0x8b, 0x1f, 0xcb, 0xe8, 0x84, 0xc4, 0xe3,
0x5d, 0x0d, 0x95, 0xb3, 0xe4, 0xe1, 0xf9, 0xe1, 0xf9, 0xec, 0x0d, 0xbe, 0xbe, 0xf0, 0x0f, 0x88,
0x4c, 0x91, 0x59, 0xfd, 0xf0, 0xed, 0xf7, 0xee, 0x98, 0x81, 0xa7, 0xed, 0x16, 0x60, 0x4e, 0x62,
0xed, 0xee, 0x2f, 0x14, 0x7f, 0xd1, 0xd0, 0xd9, 0x9e, 0x40, 0xe3, 0xdb, 0x23, 0x8c, 0x1b, 0xf4,
0xa1, 0xe8, 0x77, 0x8e, 0x06, 0x56, 0xb2, 0xaf, 0x4b, 0xd9, 0xb3, 0xb8, 0xda, 0x5f, 0x76, 0xc0,
0x40, 0xe4, 0x81, 0xa5, 0x80, 0xbf, 0x6a, 0x68, 0xbc, 0x4f, 0xda, 0xf0, 0xf2, 0x08, 0x1a, 0x06,
0x27, 0x59, 0x5f, 0x39, 0x2a, 0x5c, 0x99, 0x58, 0x92, 0x26, 0xe6, 0xf0, 0xb5, 0xfe, 0x26, 0x7c,
0x2a, 0x9c, 0xe2, 0xe6, 0xbc, 0x56, 0x9a, 0x7f, 0x6a, 0x68, 0xb2, 0x7f, 0xca, 0xf0, 0xea, 0x08,
0x7a, 0x86, 0x06, 0x5c, 0x5f, 0xfb, 0x0f, 0x06, 0x65, 0x6a, 0x55, 0x9a, 0xba, 0x85, 0x6f, 0xf6,
0x37, 0x05, 0x0d, 0xbe, 0xed, 0x90, 0x1c, 0x7e, 0xe8, 0xcf, 0x7e, 0xa7, 0x5e, 0xd7, 0xfb, 0xda,
0x83, 0xbd, 0x03, 0x43, 0xdb, 0x3f, 0x30, 0xb4, 0x5f, 0x07, 0x86, 0xf6, 0xa9, 0x69, 0x94, 0xf6,
0x9b, 0x46, 0xe9, 0x7b, 0xd3, 0x28, 0xbd, 0x9a, 0xf7, 0x99, 0x68, 0xa4, 0xae, 0x55, 0xe7, 0x61,
0x3b, 0x7b, 0xae, 0xd4, 0x7e, 0xd3, 0x36, 0x48, 0xec, 0xc4, 0x14, 0xdc, 0xb2, 0xfc, 0x4f, 0x2c,
0xfd, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x6f, 0x3f, 0x0c, 0xd6, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type QueryClient interface {
// Parameters queries the parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Queries a list of ListBalances items.
ListPoolAddresses(ctx context.Context, in *QueryListPoolAddressesRequest, opts ...grpc.CallOption) (*QueryListPoolAddressesResponse, error)
// Queries a list of GetEmmisonsFactors items.
GetEmissionsFactors(ctx context.Context, in *QueryGetEmissionsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmissionsFactorsResponse, error)
// Queries a list of ShowAvailableEmissions items.
ShowAvailableEmissions(ctx context.Context, in *QueryShowAvailableEmissionsRequest, opts ...grpc.CallOption) (*QueryShowAvailableEmissionsResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ListPoolAddresses(ctx context.Context, in *QueryListPoolAddressesRequest, opts ...grpc.CallOption) (*QueryListPoolAddressesResponse, error) {
out := new(QueryListPoolAddressesResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/ListPoolAddresses", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetEmissionsFactors(ctx context.Context, in *QueryGetEmissionsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmissionsFactorsResponse, error) {
out := new(QueryGetEmissionsFactorsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/GetEmissionsFactors", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ShowAvailableEmissions(ctx context.Context, in *QueryShowAvailableEmissionsRequest, opts ...grpc.CallOption) (*QueryShowAvailableEmissionsResponse, error) {
out := new(QueryShowAvailableEmissionsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/ShowAvailableEmissions", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Parameters queries the parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Queries a list of ListBalances items.
ListPoolAddresses(context.Context, *QueryListPoolAddressesRequest) (*QueryListPoolAddressesResponse, error)
// Queries a list of GetEmmisonsFactors items.
GetEmissionsFactors(context.Context, *QueryGetEmissionsFactorsRequest) (*QueryGetEmissionsFactorsResponse, error)
// Queries a list of ShowAvailableEmissions items.
ShowAvailableEmissions(context.Context, *QueryShowAvailableEmissionsRequest) (*QueryShowAvailableEmissionsResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) ListPoolAddresses(ctx context.Context, req *QueryListPoolAddressesRequest) (*QueryListPoolAddressesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListPoolAddresses not implemented")
}
func (*UnimplementedQueryServer) GetEmissionsFactors(ctx context.Context, req *QueryGetEmissionsFactorsRequest) (*QueryGetEmissionsFactorsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetEmissionsFactors not implemented")
}
func (*UnimplementedQueryServer) ShowAvailableEmissions(ctx context.Context, req *QueryShowAvailableEmissionsRequest) (*QueryShowAvailableEmissionsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ShowAvailableEmissions not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.emissions.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ListPoolAddresses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryListPoolAddressesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ListPoolAddresses(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.emissions.Query/ListPoolAddresses",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ListPoolAddresses(ctx, req.(*QueryListPoolAddressesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetEmissionsFactors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetEmissionsFactorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetEmissionsFactors(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.emissions.Query/GetEmissionsFactors",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetEmissionsFactors(ctx, req.(*QueryGetEmissionsFactorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ShowAvailableEmissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryShowAvailableEmissionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ShowAvailableEmissions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.emissions.Query/ShowAvailableEmissions",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ShowAvailableEmissions(ctx, req.(*QueryShowAvailableEmissionsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.emissions.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "ListPoolAddresses",
Handler: _Query_ListPoolAddresses_Handler,
},
{
MethodName: "GetEmissionsFactors",
Handler: _Query_GetEmissionsFactors_Handler,
},
{
MethodName: "ShowAvailableEmissions",
Handler: _Query_ShowAvailableEmissions_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "emissions/query.proto",
}
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryListPoolAddressesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryListPoolAddressesRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryListPoolAddressesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryListPoolAddressesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryListPoolAddressesResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryListPoolAddressesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.EmissionModuleAddress) > 0 {
i -= len(m.EmissionModuleAddress)
copy(dAtA[i:], m.EmissionModuleAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.EmissionModuleAddress)))
i--
dAtA[i] = 0x1a
}
if len(m.UndistributedTssBalancesAddress) > 0 {
i -= len(m.UndistributedTssBalancesAddress)
copy(dAtA[i:], m.UndistributedTssBalancesAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.UndistributedTssBalancesAddress)))
i--
dAtA[i] = 0x12
}
if len(m.UndistributedObserverBalancesAddress) > 0 {
i -= len(m.UndistributedObserverBalancesAddress)
copy(dAtA[i:], m.UndistributedObserverBalancesAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.UndistributedObserverBalancesAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetEmissionsFactorsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetEmissionsFactorsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetEmissionsFactorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryGetEmissionsFactorsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetEmissionsFactorsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetEmissionsFactorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.DurationFactor) > 0 {
i -= len(m.DurationFactor)
copy(dAtA[i:], m.DurationFactor)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DurationFactor)))
i--
dAtA[i] = 0x1a
}
if len(m.BondFactor) > 0 {
i -= len(m.BondFactor)
copy(dAtA[i:], m.BondFactor)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BondFactor)))
i--
dAtA[i] = 0x12
}
if len(m.ReservesFactor) > 0 {
i -= len(m.ReservesFactor)
copy(dAtA[i:], m.ReservesFactor)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ReservesFactor)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryShowAvailableEmissionsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryShowAvailableEmissionsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryShowAvailableEmissionsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryShowAvailableEmissionsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryShowAvailableEmissionsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryShowAvailableEmissionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Amount) > 0 {
i -= len(m.Amount)
copy(dAtA[i:], m.Amount)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Amount)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *QueryParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryListPoolAddressesRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryListPoolAddressesResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.UndistributedObserverBalancesAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.UndistributedTssBalancesAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.EmissionModuleAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetEmissionsFactorsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryGetEmissionsFactorsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ReservesFactor)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.BondFactor)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.DurationFactor)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryShowAvailableEmissionsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryShowAvailableEmissionsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Amount)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryListPoolAddressesRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryListPoolAddressesRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryListPoolAddressesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryListPoolAddressesResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryListPoolAddressesResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryListPoolAddressesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UndistributedObserverBalancesAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.UndistributedObserverBalancesAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UndistributedTssBalancesAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.UndistributedTssBalancesAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EmissionModuleAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.EmissionModuleAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetEmissionsFactorsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetEmissionsFactorsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetEmissionsFactorsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetEmissionsFactorsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetEmissionsFactorsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetEmissionsFactorsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ReservesFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ReservesFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BondFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BondFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DurationFactor", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DurationFactor = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryShowAvailableEmissionsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryShowAvailableEmissionsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryShowAvailableEmissionsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryShowAvailableEmissionsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryShowAvailableEmissionsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryShowAvailableEmissionsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Amount = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthQuery
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupQuery
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthQuery
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: emissions/query.proto
/*
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package types
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := server.Params(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_ListPoolAddresses_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryListPoolAddressesRequest
var metadata runtime.ServerMetadata
msg, err := client.ListPoolAddresses(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ListPoolAddresses_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryListPoolAddressesRequest
var metadata runtime.ServerMetadata
msg, err := server.ListPoolAddresses(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GetEmissionsFactors_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetEmissionsFactorsRequest
var metadata runtime.ServerMetadata
msg, err := client.GetEmissionsFactors(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetEmissionsFactors_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetEmissionsFactorsRequest
var metadata runtime.ServerMetadata
msg, err := server.GetEmissionsFactors(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_ShowAvailableEmissions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryShowAvailableEmissionsRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["address"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
}
protoReq.Address, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
}
msg, err := client.ShowAvailableEmissions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ShowAvailableEmissions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryShowAvailableEmissionsRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["address"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
}
protoReq.Address, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
}
msg, err := server.ShowAvailableEmissions(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ListPoolAddresses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ListPoolAddresses_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ListPoolAddresses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetEmissionsFactors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetEmissionsFactors_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetEmissionsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ShowAvailableEmissions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ShowAvailableEmissions_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ShowAvailableEmissions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterQueryHandler(ctx, mux, conn)
}
// RegisterQueryHandler registers the http handlers for service Query to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
}
// RegisterQueryHandlerClient registers the http handlers for service Query
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ListPoolAddresses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ListPoolAddresses_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ListPoolAddresses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetEmissionsFactors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetEmissionsFactors_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetEmissionsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ShowAvailableEmissions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ShowAvailableEmissions_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ShowAvailableEmissions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "emissions", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ListPoolAddresses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "emissions", "list_addresses"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetEmissionsFactors_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "emissions", "get_emissions_factors"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ShowAvailableEmissions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "emissions", "show_available_emissions", "address"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_ListPoolAddresses_0 = runtime.ForwardResponseMessage
forward_Query_GetEmissionsFactors_0 = runtime.ForwardResponseMessage
forward_Query_ShowAvailableEmissions_0 = runtime.ForwardResponseMessage
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: emissions/tx.proto
package types
import (
context "context"
fmt "fmt"
math "math"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() { proto.RegisterFile("emissions/tx.proto", fileDescriptor_618f91fd090d1520) }
var fileDescriptor_618f91fd090d1520 = []byte{
// 147 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4a, 0xcd, 0xcd, 0x2c,
0x2e, 0xce, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92,
0xa9, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5,
0xe0, 0xca, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x0a, 0xf5, 0x41, 0x2c, 0x88, 0x1e, 0x23,
0x56, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0x27, 0xaf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63,
0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96,
0x63, 0x88, 0x32, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x99,
0xaa, 0x0b, 0xb6, 0x40, 0x1f, 0x66, 0x81, 0x7e, 0x85, 0x3e, 0x92, 0x4b, 0x2a, 0x0b, 0x52, 0x8b,
0x93, 0xd8, 0xc0, 0x26, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x92, 0xdd, 0x96, 0x7e, 0xa3,
0x00, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MsgClient interface {
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.emissions.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{},
Metadata: "emissions/tx.proto",
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: emissions/withdrawable_emissions.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type WithdrawableEmissions struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"`
}
func (m *WithdrawableEmissions) Reset() { *m = WithdrawableEmissions{} }
func (m *WithdrawableEmissions) String() string { return proto.CompactTextString(m) }
func (*WithdrawableEmissions) ProtoMessage() {}
func (*WithdrawableEmissions) Descriptor() ([]byte, []int) {
return fileDescriptor_56e0acf72be654f9, []int{0}
}
func (m *WithdrawableEmissions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *WithdrawableEmissions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_WithdrawableEmissions.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *WithdrawableEmissions) XXX_Merge(src proto.Message) {
xxx_messageInfo_WithdrawableEmissions.Merge(m, src)
}
func (m *WithdrawableEmissions) XXX_Size() int {
return m.Size()
}
func (m *WithdrawableEmissions) XXX_DiscardUnknown() {
xxx_messageInfo_WithdrawableEmissions.DiscardUnknown(m)
}
var xxx_messageInfo_WithdrawableEmissions proto.InternalMessageInfo
func (m *WithdrawableEmissions) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
func init() {
proto.RegisterType((*WithdrawableEmissions)(nil), "zetachain.zetacore.emissions.WithdrawableEmissions")
}
func init() {
proto.RegisterFile("emissions/withdrawable_emissions.proto", fileDescriptor_56e0acf72be654f9)
}
var fileDescriptor_56e0acf72be654f9 = []byte{
// 233 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0xcd, 0xcd, 0x2c,
0x2e, 0xce, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0x4f, 0x4c,
0xca, 0x49, 0x8d, 0x87, 0x0b, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xc9, 0x54, 0xa5, 0x96,
0x24, 0x26, 0x67, 0x24, 0x66, 0xe6, 0xe9, 0x81, 0x59, 0xf9, 0x45, 0xa9, 0x7a, 0x70, 0x35, 0x52,
0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x85, 0xfa, 0x20, 0x16, 0x44, 0x8f, 0x52, 0x25, 0x97, 0x68,
0x38, 0x92, 0x99, 0xae, 0x30, 0xe5, 0x42, 0x12, 0x5c, 0xec, 0x89, 0x29, 0x29, 0x45, 0xa9, 0xc5,
0xc5, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x30, 0xae, 0x90, 0x1b, 0x17, 0x5b, 0x62, 0x6e,
0x7e, 0x69, 0x5e, 0x89, 0x04, 0x13, 0x48, 0xc2, 0x49, 0xef, 0xc4, 0x3d, 0x79, 0x86, 0x5b, 0xf7,
0xe4, 0xd5, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x93, 0xf3, 0x8b,
0x73, 0xf3, 0x8b, 0xa1, 0x94, 0x6e, 0x71, 0x4a, 0xb6, 0x7e, 0x49, 0x65, 0x41, 0x6a, 0xb1, 0x9e,
0x67, 0x5e, 0x49, 0x10, 0x54, 0xb7, 0x93, 0xd7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31,
0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb,
0x31, 0x44, 0x19, 0x20, 0x99, 0x04, 0xf2, 0x89, 0x2e, 0xd8, 0x53, 0xfa, 0x30, 0x4f, 0xe9, 0x57,
0xe8, 0x23, 0x42, 0x04, 0x6c, 0x6e, 0x12, 0x1b, 0xd8, 0x37, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff,
0xff, 0x99, 0xf1, 0xaf, 0x2c, 0x2b, 0x01, 0x00, 0x00,
}
func (m *WithdrawableEmissions) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *WithdrawableEmissions) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *WithdrawableEmissions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.Amount.Size()
i -= size
if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintWithdrawableEmissions(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintWithdrawableEmissions(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintWithdrawableEmissions(dAtA []byte, offset int, v uint64) int {
offset -= sovWithdrawableEmissions(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *WithdrawableEmissions) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovWithdrawableEmissions(uint64(l))
}
l = m.Amount.Size()
n += 1 + l + sovWithdrawableEmissions(uint64(l))
return n
}
func sovWithdrawableEmissions(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozWithdrawableEmissions(x uint64) (n int) {
return sovWithdrawableEmissions(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *WithdrawableEmissions) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWithdrawableEmissions
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: WithdrawableEmissions: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: WithdrawableEmissions: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWithdrawableEmissions
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthWithdrawableEmissions
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthWithdrawableEmissions
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWithdrawableEmissions
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthWithdrawableEmissions
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthWithdrawableEmissions
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipWithdrawableEmissions(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthWithdrawableEmissions
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipWithdrawableEmissions(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowWithdrawableEmissions
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowWithdrawableEmissions
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowWithdrawableEmissions
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthWithdrawableEmissions
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupWithdrawableEmissions
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthWithdrawableEmissions
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthWithdrawableEmissions = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowWithdrawableEmissions = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupWithdrawableEmissions = fmt.Errorf("proto: unexpected end of group")
)
package cli
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// GetQueryCmd returns the cli query commands for this module
func GetQueryCmd(_ string) *cobra.Command {
// Group fungible queries under a subcommand
cmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
CmdQueryParams(),
CmdListForeignCoins(),
CmdShowForeignCoins(),
CmdGasStabilityPoolAddress(),
CmdGasStabilityPoolBalance(),
CmdGasStabilityPoolBalances(),
CmdSystemContract(),
)
return cmd
}
package cli
import (
"context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func CmdListForeignCoins() *cobra.Command {
cmd := &cobra.Command{
Use: "list-foreign-coins",
Short: "list all ForeignCoins",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAllForeignCoinsRequest{
Pagination: pageReq,
}
res, err := queryClient.ForeignCoinsAll(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdShowForeignCoins() *cobra.Command {
cmd := &cobra.Command{
Use: "show-foreign-coins [index]",
Short: "shows a ForeignCoins",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
argIndex := args[0]
params := &types.QueryGetForeignCoinsRequest{
Index: argIndex,
}
res, err := queryClient.ForeignCoins(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func CmdGasStabilityPoolAddress() *cobra.Command {
cmd := &cobra.Command{
Use: "gas-stability-pool-address",
Short: "query the address of a gas stability pool",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.GasStabilityPoolAddress(context.Background(), &types.QueryGetGasStabilityPoolAddress{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdGasStabilityPoolBalance() *cobra.Command {
cmd := &cobra.Command{
Use: "gas-stability-pool-balance [chain-id]",
Short: "query the balance of a gas stability pool for a chain",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
chainID, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetGasStabilityPoolBalance{
ChainId: chainID,
}
res, err := queryClient.GasStabilityPoolBalance(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
func CmdGasStabilityPoolBalances() *cobra.Command {
cmd := &cobra.Command{
Use: "gas-stability-pool-balances",
Short: "query all gas stability pool balances",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.GasStabilityPoolBalanceAll(context.Background(), &types.QueryAllGasStabilityPoolBalance{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmd.Use)
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func CmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Short: "shows the parameters of the module",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func CmdSystemContract() *cobra.Command {
cmd := &cobra.Command{
Use: "system-contract",
Short: "query system contract",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.SystemContract(context.Background(), &types.QueryGetSystemContractRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
package cli
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// GetTxCmd returns the transaction commands for this module
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
CmdDeployFungibleCoinZRC4(),
CmdRemoveForeignCoin(),
CmdUpdateZRC20LiquidityCap(),
)
return cmd
}
package cli
import (
"fmt"
"strconv"
"github.com/zeta-chain/zetacore/common"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func CmdDeployFungibleCoinZRC4() *cobra.Command {
cmd := &cobra.Command{
Use: "deploy-fungible-coin-zrc-4 [erc-20] [foreign-chain] [decimals] [name] [symbol] [coin-type] [gas-limit]",
Short: "Broadcast message DeployFungibleCoinZRC20",
Args: cobra.ExactArgs(6),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argERC20 := args[0]
argForeignChain, err := strconv.ParseInt(args[1], 10, 32)
if err != nil {
return err
}
argDecimals, err := strconv.ParseUint(args[2], 10, 32)
if err != nil {
return err
}
argName := args[3]
argSymbol := args[4]
argCoinType, err := strconv.ParseInt(args[5], 10, 32)
if err != nil {
return err
}
argGasLimit, err := strconv.ParseInt(args[6], 10, 64)
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
fmt.Printf("CLI address: %s\n", clientCtx.GetFromAddress().String())
msg := types.NewMsgDeployFungibleCoinZRC20(
clientCtx.GetFromAddress().String(),
argERC20,
argForeignChain,
// #nosec G701 parsed in range
uint32(argDecimals),
argName,
argSymbol,
common.CoinType(argCoinType),
argGasLimit,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package cli
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func CmdRemoveForeignCoin() *cobra.Command {
cmd := &cobra.Command{
Use: "remove-foreign-coin [name]",
Short: "Broadcast message RemoveForeignCoin",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argName := args[0]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgRemoveForeignCoin(
clientCtx.GetFromAddress().String(),
argName,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package cli
import (
"fmt"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func CmdUpdateZRC20LiquidityCap() *cobra.Command {
cmd := &cobra.Command{
Use: "update-zrc20-liquidity-cap [zrc20] [liquidity-cap]",
Short: "Broadcast message UpdateZRC20LiquidityCap",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) (err error) {
newCap := math.NewUintFromString(args[1])
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
fmt.Printf("CLI address: %s\n", clientCtx.GetFromAddress().String())
msg := types.NewMsgUpdateZRC20LiquidityCap(
clientCtx.GetFromAddress().String(),
args[0],
newCap,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
package fungible
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/fungible/keeper"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// InitGenesis initializes the fungible module's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
// Set all the foreignCoins
for _, elem := range genState.ForeignCoinsList {
k.SetForeignCoins(ctx, elem)
}
// Set if defined
if genState.SystemContract != nil {
k.SetSystemContract(ctx, *genState.SystemContract)
}
k.SetParams(ctx, genState.Params)
}
// ExportGenesis returns the fungible module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
var genesis types.GenesisState
genesis.Params = k.GetParams(ctx)
genesis.ForeignCoinsList = k.GetAllForeignCoins(ctx)
// Get all zetaDepositAndCallContract
system, found := k.GetSystemContract(ctx)
if found {
genesis.SystemContract = &system
}
return &genesis
}
//go:build TESTNET
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
// This is for privnet/testnet only
func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error {
ctx := sdk.UnwrapSDKContext(goCtx)
// setup uniswap v2 factory
uniswapV2Factory, err := k.DeployUniswapV2Factory(ctx)
if err != nil {
return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Factory")
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute("UniswapV2Factory", uniswapV2Factory.String()),
),
)
// setup WZETA contract
wzeta, err := k.DeployWZETA(ctx)
if err != nil {
return sdkerrors.Wrapf(err, "failed to DeployWZetaContract")
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute("DeployWZetaContract", wzeta.String()),
),
)
router, err := k.DeployUniswapV2Router02(ctx, uniswapV2Factory, wzeta)
if err != nil {
return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Router02")
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute("DeployUniswapV2Router02", router.String()),
),
)
connector, err := k.DeployConnectorZEVM(ctx, wzeta)
if err != nil {
return sdkerrors.Wrapf(err, "failed to DeployConnectorZEVM")
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute("DeployConnectorZEVM", connector.String()),
),
)
ctx.Logger().Info("Deployed Connector ZEVM at " + connector.String())
SystemContractAddress, err := k.DeploySystemContract(ctx, wzeta, uniswapV2Factory, router)
if err != nil {
return sdkerrors.Wrapf(err, "failed to SystemContractAddress")
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute("SystemContractAddress", SystemContractAddress.String()),
),
)
// set the system contract
system, _ := k.GetSystemContract(ctx)
system.SystemContract = SystemContractAddress.String()
// FIXME: remove unnecessary SetGasPrice and setupChainGasCoinAndPool
k.SetSystemContract(ctx, system)
//err = k.SetGasPrice(ctx, big.NewInt(1337), big.NewInt(1))
if err != nil {
return err
}
_, err = k.SetupChainGasCoinAndPool(ctx, common.GoerliChain().ChainId, "ETH", "gETH", 18, nil)
if err != nil {
return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
_, err = k.SetupChainGasCoinAndPool(ctx, common.BscTestnetChain().ChainId, "BNB", "tBNB", 18, nil)
if err != nil {
return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
_, err = k.SetupChainGasCoinAndPool(ctx, common.MumbaiChain().ChainId, "MATIC", "tMATIC", 18, nil)
if err != nil {
return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
_, err = k.SetupChainGasCoinAndPool(ctx, common.BtcTestNetChain().ChainId, "BTC", "tBTC", 8, nil)
if err != nil {
return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
return nil
}
func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error {
return nil
}
func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error {
return nil
}
package keeper
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
eth "github.com/ethereum/go-ethereum/common"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
"github.com/zeta-chain/zetacore/common"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// DepositCoinZeta immediately mints ZETA to the EVM account
func (k Keeper) DepositCoinZeta(ctx sdk.Context, to eth.Address, amount *big.Int) error {
zetaToAddress := sdk.AccAddress(to.Bytes())
return k.MintZetaToEVMAccount(ctx, zetaToAddress, amount)
}
// ZRC20DepositAndCallContract deposits ZRC20 to the EVM account and calls the contract
// returns [txResponse, isContractCall, error]
// isContractCall is true if the receiver is a contract and a contract call was made
func (k Keeper) ZRC20DepositAndCallContract(
ctx sdk.Context,
from []byte,
to eth.Address,
amount *big.Int,
senderChain *common.Chain,
data []byte,
coinType common.CoinType,
asset string,
) (*evmtypes.MsgEthereumTxResponse, bool, error) {
var ZRC20Contract eth.Address
var coin types.ForeignCoins
var found bool
// get foreign coin
if coinType == common.CoinType_Gas {
coin, found = k.GetGasCoinForForeignCoin(ctx, senderChain.ChainId)
if !found {
return nil, false, crosschaintypes.ErrGasCoinNotFound
}
} else {
coin, found = k.GetForeignCoinFromAsset(ctx, asset, senderChain.ChainId)
if !found {
return nil, false, crosschaintypes.ErrForeignCoinNotFound
}
}
ZRC20Contract = eth.HexToAddress(coin.Zrc20ContractAddress)
// check foreign coins cap if it has a cap
if !coin.LiquidityCap.IsNil() && !coin.LiquidityCap.IsZero() {
liquidityCap := coin.LiquidityCap.BigInt()
totalSupply, err := k.TotalSupplyZRC4(ctx, ZRC20Contract)
if err != nil {
return nil, false, err
}
newSupply := new(big.Int).Add(totalSupply, amount)
if newSupply.Cmp(liquidityCap) > 0 {
return nil, false, types.ErrForeignCoinCapReached
}
}
// check if the receiver is a contract
// if it is, then the hook onCrossChainCall() will be called
// if not, the zrc20 are simply transferred to the receiver
acc := k.evmKeeper.GetAccount(ctx, to)
if acc != nil && acc.IsContract() {
context := systemcontract.ZContext{
Origin: from,
Sender: eth.Address{},
ChainID: big.NewInt(senderChain.ChainId),
}
res, err := k.DepositZRC20AndCallContract(ctx, context, ZRC20Contract, to, amount, data)
return res, true, err
}
// if the account is a EOC, no contract call can be made with the data
if len(data) > 0 {
return nil, false, types.ErrCallNonContract
}
res, err := k.DepositZRC20(ctx, ZRC20Contract, to, amount)
return res, false, err
}
package keeper
import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"math/big"
"strconv"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
evmtypes "github.com/evmos/ethermint/x/evm/types"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmtypes "github.com/tendermint/tendermint/types"
connectorzevm "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/connectorzevm.sol"
systemcontract "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/wzeta.sol"
zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
uniswapv2factory "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-core/contracts/uniswapv2factory.sol"
uniswapv2router02 "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol"
zetacommon "github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/server/config"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// TODO USE string constant
var (
BigIntZero = big.NewInt(0)
ZEVMGasLimitDepositAndCall = big.NewInt(1_000_000)
)
// DeployContract deploys a new contract in the ZEVM
func (k Keeper) DeployContract(ctx sdk.Context, metadata *bind.MetaData, ctorArguments ...interface{}) (common.Address, error) {
contractABI, err := metadata.GetAbi()
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(types.ErrABIGet, "failed to get ABI: %s", err.Error())
}
ctorArgs, err := contractABI.Pack(
"", // function--empty string for constructor
ctorArguments..., // feeToSetter
)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(types.ErrABIGet, "failed to abi.Pack ctor arguments: %s", err.Error())
}
if len(metadata.Bin) <= 2 {
return common.Address{}, cosmoserrors.Wrapf(types.ErrABIGet, "metadata Bin field too short: %s", err.Error())
}
bin, err := hex.DecodeString(metadata.Bin[2:])
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(types.ErrABIPack, "error decoding %s hex bytecode string: %s", metadata.Bin[2:], err.Error())
}
data := make([]byte, len(bin)+len(ctorArgs))
copy(data[:len(bin)], bin)
copy(data[len(bin):], ctorArgs)
nonce, err := k.authKeeper.GetSequence(ctx, types.ModuleAddress.Bytes())
if err != nil {
return common.Address{}, err
}
contractAddr := crypto.CreateAddress(types.ModuleAddressEVM, nonce)
_, err = k.CallEVMWithData(ctx, types.ModuleAddressEVM, nil, data, true, false, BigIntZero, nil)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "failed to deploy contract")
}
return contractAddr, nil
}
// DeployZRC20Contract creates and deploys an ERC20 contract on the EVM with the
// erc20 module account as owner. Also adds itself to ForeignCoins fungible module state variable
// TODO Unit test for these functions
// https://github.com/zeta-chain/node/issues/864
// TODO Remove repetitive code
func (k Keeper) DeployZRC20Contract(
ctx sdk.Context,
name, symbol string,
decimals uint8,
chainID int64,
coinType zetacommon.CoinType,
erc20Contract string,
gasLimit *big.Int,
) (common.Address, error) {
chain := zetacommon.GetChainFromChainID(chainID)
if chain == nil {
return common.Address{}, cosmoserrors.Wrapf(zetaObserverTypes.ErrSupportedChains, "chain %d not found", chainID)
}
chainStr := chain.ChainName.String()
if chain == nil {
return common.Address{}, cosmoserrors.Wrapf(zetaObserverTypes.ErrSupportedChains, "chain %s not found", chainStr)
}
system, found := k.GetSystemContract(ctx)
if !found {
return common.Address{}, cosmoserrors.Wrapf(types.ErrSystemContractNotFound, "system contract not found")
}
contractAddr, err := k.DeployContract(ctx, zrc20.ZRC20MetaData,
name, // name
symbol, // symbol
decimals, // decimals
big.NewInt(chain.ChainId), // chainID
// #nosec G701 always in range
uint8(coinType), // coinType: 0: Zeta 1: gas 2 ERC20
gasLimit, //gas limit for transfer; 21k for gas asset; around 70k for ERC20
common.HexToAddress(system.SystemContract),
)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(types.ErrABIPack, "failed to deploy ZRC20 contract: %s, %s", name, err.Error())
}
coin, _ := k.GetForeignCoins(ctx, contractAddr.Hex())
coin.CoinType = coinType
coin.Name = name
coin.Symbol = symbol
coin.Decimals = uint32(decimals)
coin.Asset = erc20Contract
coin.Zrc20ContractAddress = contractAddr.Hex()
coin.ForeignChainId = chain.ChainId
coin.GasLimit = gasLimit.Uint64()
k.SetForeignCoins(ctx, coin)
return contractAddr, nil
}
func (k Keeper) DeploySystemContract(ctx sdk.Context, wzeta common.Address, v2factory common.Address, router02 common.Address) (common.Address, error) {
system, _ := k.GetSystemContract(ctx)
contractAddr, err := k.DeployContract(ctx, systemcontract.SystemContractMetaData, wzeta, v2factory, router02)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "failed to deploy SystemContract")
}
system.SystemContract = contractAddr.String()
k.SetSystemContract(ctx, system)
return contractAddr, nil
}
func (k Keeper) DeployUniswapV2Factory(ctx sdk.Context) (common.Address, error) {
// this comes from Ethereum UniswapV2Factory bytecode
// https://etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f#code
refFactoryBytecode := "0x608060405234801561001057600080fd5b506040516136863803806136868339818101604052602081101561003357600080fd5b5051600180546001600160a01b0319166001600160a01b03909216919091179055613623806100636000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063a2e74af61161005b578063a2e74af6146100fd578063c9c6539614610132578063e6a439051461016d578063f46901ed146101a857610088565b8063017e7e581461008d578063094b7415146100be5780631e3dd18b146100c6578063574f2ba3146100e3575b600080fd5b6100956101db565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100956101f7565b610095600480360360208110156100dc57600080fd5b5035610213565b6100eb610247565b60408051918252519081900360200190f35b6101306004803603602081101561011357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661024d565b005b6100956004803603604081101561014857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661031a565b6100956004803603604081101561018357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661076d565b610130600480360360208110156101be57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166107a0565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b6003818154811061022057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60035490565b60015473ffffffffffffffffffffffffffffffffffffffff1633146102d357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156103b757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f556e697377617056323a204944454e544943414c5f4144445245535345530000604482015290519081900360640190fd5b6000808373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16106103f45783856103f7565b84845b909250905073ffffffffffffffffffffffffffffffffffffffff821661047e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f556e697377617056323a205a45524f5f41444452455353000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82811660009081526002602090815260408083208585168452909152902054161561051f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f556e697377617056323a20504149525f45584953545300000000000000000000604482015290519081900360640190fd5b6060604051806020016105319061086d565b6020820181038252601f19601f82011660405250905060008383604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140192505050604051602081830303815290604052805190602001209050808251602084016000f5604080517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152868116602483015291519297509087169163485cc9559160448082019260009290919082900301818387803b15801561065e57600080fd5b505af1158015610672573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff84811660008181526002602081815260408084208987168086529083528185208054978d167fffffffffffffffffffffffff000000000000000000000000000000000000000098891681179091559383528185208686528352818520805488168517905560038054600181018255958190527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90950180549097168417909655925483519283529082015281517f0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9929181900390910190a35050505092915050565b600260209081526000928352604080842090915290825290205473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff16331461082657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612d748061087b8339019056fe60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429a265627a7a723158202760f92d7fa1db6f5aa16307bad65df4ebcc8550c4b1f03755ab8dfd830c178f64736f6c63430005100032"
uniswapv2factory.UniswapV2FactoryMetaData.Bin = refFactoryBytecode
contractAddr, err := k.DeployContract(ctx, uniswapv2factory.UniswapV2FactoryMetaData, types.ModuleAddressEVM)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "UniswapV2FactoryContract")
}
return contractAddr, nil
}
func (k Keeper) DeployUniswapV2Router02(ctx sdk.Context, factory common.Address, wzeta common.Address) (common.Address, error) {
contractAddr, err := k.DeployContract(ctx, uniswapv2router02.UniswapV2Router02MetaData, factory, wzeta)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "UniswapV2Router02")
}
return contractAddr, nil
}
func (k Keeper) DeployWZETA(ctx sdk.Context) (common.Address, error) {
contractAddr, err := k.DeployContract(ctx, wzeta.WETH9MetaData)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "WZETA")
}
return contractAddr, nil
}
func (k Keeper) DeployConnectorZEVM(ctx sdk.Context, wzeta common.Address) (common.Address, error) {
contractAddr, err := k.DeployContract(ctx, connectorzevm.ZetaConnectorZEVMMetaData, wzeta)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "ZetaConnectorZEVM")
}
system, _ := k.GetSystemContract(ctx)
system.ConnectorZevm = contractAddr.Hex()
k.SetSystemContract(ctx, system)
return contractAddr, nil
}
// DepositZRC20 deposits ZRC4 tokens into to account;
// Callable only by the fungible module account
// returns directly CallEVM()
func (k Keeper) DepositZRC20(
ctx sdk.Context,
contract common.Address,
to common.Address,
amount *big.Int,
) (*evmtypes.MsgEthereumTxResponse, error) {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, err
}
return k.CallEVM(
ctx,
*zrc20ABI,
types.ModuleAddressEVM,
contract,
BigIntZero,
nil,
true,
false,
"deposit",
to,
amount,
)
}
// UpdateZRC20ProtocolFlatFee updates the protocol flat fee for a given ZRC20 contract
func (k Keeper) UpdateZRC20ProtocolFlatFee(
ctx sdk.Context,
zrc20Addr common.Address,
newFee *big.Int,
) (*evmtypes.MsgEthereumTxResponse, error) {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, err
}
return k.CallEVM(
ctx,
*zrc20ABI,
types.ModuleAddressEVM,
zrc20Addr,
BigIntZero,
nil,
true,
false,
"updateProtocolFlatFee",
newFee,
)
}
// UpdateZRC20GasLimit updates the gas limit for a given ZRC20 contract
func (k Keeper) UpdateZRC20GasLimit(
ctx sdk.Context,
zrc20Addr common.Address,
newGasLimit *big.Int,
) (*evmtypes.MsgEthereumTxResponse, error) {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, err
}
return k.CallEVM(
ctx,
*zrc20ABI,
types.ModuleAddressEVM,
zrc20Addr,
BigIntZero,
nil,
true,
false,
"updateGasLimit",
newGasLimit,
)
}
// DepositZRC20AndCallContract deposits into ZRC4 and call contract function in a single tx
// callable from fungible module
// Returns directly results from CallEVM
func (k Keeper) DepositZRC20AndCallContract(ctx sdk.Context,
context systemcontract.ZContext,
zrc20Addr common.Address,
targetContract common.Address,
amount *big.Int,
message []byte,
) (*evmtypes.MsgEthereumTxResponse, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return nil, cosmoserrors.Wrapf(types.ErrContractNotFound, "GetSystemContract address not found")
}
systemAddress := common.HexToAddress(system.SystemContract)
sysConABI, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return nil, err
}
return k.CallEVM(
ctx,
*sysConABI,
types.ModuleAddressEVM,
systemAddress,
BigIntZero,
ZEVMGasLimitDepositAndCall,
true,
false,
"depositAndCall",
context,
zrc20Addr,
amount,
targetContract,
message,
)
}
// QueryWithdrawGasFee returns the gas fee for a withdrawal transaction associated with a given zrc20
func (k Keeper) QueryWithdrawGasFee(ctx sdk.Context, contract common.Address) (*big.Int, error) {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, err
}
res, err := k.CallEVM(
ctx,
*zrc20ABI,
types.ModuleAddressEVM,
contract,
BigIntZero,
nil,
false,
false,
"withdrawGasFee",
)
if err != nil {
return nil, err
}
unpacked, err := zrc20ABI.Unpack("withdrawGasFee", res.Ret)
if err != nil {
return nil, err
}
if len(unpacked) < 2 {
return nil, fmt.Errorf("expect 2 returned values, got %d", len(unpacked))
}
GasFee, ok := unpacked[1].(*big.Int)
if !ok {
return nil, errors.New("can't read returned value as big.Int")
}
return GasFee, nil
}
// QueryProtocolFlatFee returns the protocol flat fee associated with a given zrc20
func (k Keeper) QueryProtocolFlatFee(ctx sdk.Context, contract common.Address) (*big.Int, error) {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, err
}
res, err := k.CallEVM(
ctx,
*zrc20ABI,
types.ModuleAddressEVM,
contract,
BigIntZero,
nil,
false,
false,
"PROTOCOL_FLAT_FEE",
)
if err != nil {
return nil, err
}
unpacked, err := zrc20ABI.Unpack("PROTOCOL_FLAT_FEE", res.Ret)
if err != nil {
return nil, err
}
if len(unpacked) == 0 {
return nil, fmt.Errorf("expect 1 returned values, got %d", len(unpacked))
}
protocolGasFee, ok := unpacked[0].(*big.Int)
if !ok {
return nil, errors.New("can't read returned value as big.Int")
}
return protocolGasFee, nil
}
// QueryGasLimit returns the gas limit for a withdrawal transaction associated with a given zrc20
func (k Keeper) QueryGasLimit(ctx sdk.Context, contract common.Address) (*big.Int, error) {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, err
}
res, err := k.CallEVM(
ctx,
*zrc20ABI,
types.ModuleAddressEVM,
contract,
BigIntZero,
nil,
false,
false,
"GAS_LIMIT",
)
if err != nil {
return nil, err
}
unpacked, err := zrc20ABI.Unpack("GAS_LIMIT", res.Ret)
if err != nil {
return nil, err
}
if len(unpacked) == 0 {
return nil, fmt.Errorf("expect 1 returned values, got %d", len(unpacked))
}
gasLimit, ok := unpacked[0].(*big.Int)
if !ok {
return nil, errors.New("can't read returned value as big.Int")
}
return gasLimit, nil
}
// QueryZRC20Data returns the data of a deployed ZRC20 contract
func (k Keeper) QueryZRC20Data(
ctx sdk.Context,
contract common.Address,
) (types.ZRC20Data, error) {
var (
nameRes types.ZRC20StringResponse
symbolRes types.ZRC20StringResponse
decimalRes types.ZRC20Uint8Response
)
zrc4ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return types.ZRC20Data{}, sdkerrors.Wrapf(
types.ErrABIUnpack, "failed to get ABI: %s", err.Error(),
)
}
// Name
res, err := k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "name")
if err != nil {
return types.ZRC20Data{}, err
}
if err := zrc4ABI.UnpackIntoInterface(&nameRes, "name", res.Ret); err != nil {
return types.ZRC20Data{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack name: %s", err.Error())
}
// Symbol
res, err = k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "symbol")
if err != nil {
return types.ZRC20Data{}, err
}
if err := zrc4ABI.UnpackIntoInterface(&symbolRes, "symbol", res.Ret); err != nil {
return types.ZRC20Data{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack symbol: %s", err.Error())
}
// Decimals
res, err = k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "decimals")
if err != nil {
return types.ZRC20Data{}, err
}
if err := zrc4ABI.UnpackIntoInterface(&decimalRes, "decimals", res.Ret); err != nil {
return types.ZRC20Data{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack decimals: %s", err.Error())
}
return types.NewZRC20Data(nameRes.Value, symbolRes.Value, decimalRes.Value), nil
}
// BalanceOfZRC4 queries an account's balance for a given ZRC4 contract
func (k Keeper) BalanceOfZRC4(
ctx sdk.Context,
contract, account common.Address,
) (*big.Int, error) {
zrc4ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
res, err := k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "balanceOf",
account)
if err != nil {
return nil, err
}
unpacked, err := zrc4ABI.Unpack("balanceOf", res.Ret)
if err != nil || len(unpacked) == 0 {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
balance, ok := unpacked[0].(*big.Int)
if !ok {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack balance")
}
return balance, nil
}
// TotalSupplyZRC4 queries the total supply of a given ZRC4 contract
func (k Keeper) TotalSupplyZRC4(
ctx sdk.Context,
contract common.Address,
) (*big.Int, error) {
abi, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "totalSupply")
if err != nil {
return nil, err
}
unpacked, err := abi.Unpack("totalSupply", res.Ret)
if err != nil || len(unpacked) == 0 {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
totalSupply, ok := unpacked[0].(*big.Int)
if !ok {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack total supply")
}
return totalSupply, nil
}
// QueryChainIDFromContract returns the chain id of the chain
func (k Keeper) QueryChainIDFromContract(
ctx sdk.Context,
contract common.Address,
) (*big.Int, error) {
abi, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "CHAIN_ID")
if err != nil {
return nil, err
}
unpacked, err := abi.Unpack("CHAIN_ID", res.Ret)
if err != nil || len(unpacked) == 0 {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
chainID, ok := unpacked[0].(*big.Int)
if !ok {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack chain ID")
}
return chainID, nil
}
// CallEVM performs a smart contract method call using given args
// returns (msg,err) the EVM execution result if there is any, even if error is non-nil due to contract reverts
// Furthermore, err!=nil && msg!=nil && msg.Failed() means the contract call reverted.
func (k Keeper) CallEVM(
ctx sdk.Context,
abi abi.ABI,
from, contract common.Address,
value, gasLimit *big.Int,
commit bool,
noEthereumTxEvent bool,
method string,
args ...interface{},
) (*evmtypes.MsgEthereumTxResponse, error) {
data, err := abi.Pack(method, args...)
if err != nil {
return nil, cosmoserrors.Wrap(
types.ErrABIPack,
cosmoserrors.Wrap(err, "failed to create transaction data").Error(),
)
}
k.Logger(ctx).Debug("calling EVM", "from", from, "contract", contract, "value", value, "method", method)
resp, err := k.CallEVMWithData(ctx, from, &contract, data, commit, noEthereumTxEvent, value, gasLimit)
if err != nil {
return resp, cosmoserrors.Wrapf(err, "contract call failed: method '%s', contract '%s'", method, contract)
}
return resp, nil
}
// CallEVMWithData performs a smart contract method call using contract data
// value is the amount of wei to send; gaslimit is the custom gas limit, if nil EstimateGas is used
// to bisect the correct gas limit (this may sometimes result in insufficient gas limit; not sure why)
//
// returns (msg,err) the EVM execution result if there is any, even if error is non-nil due to contract reverts
// Furthermore, err!=nil && msg!=nil && msg.Failed() means the contract call reverted; in which case
// msg.Ret gives the RET code if contract revert with REVERT opcode with parameters.
func (k Keeper) CallEVMWithData(
ctx sdk.Context,
from common.Address,
contract *common.Address,
data []byte,
commit bool,
noEthereumTxEvent bool,
value *big.Int,
gasLimit *big.Int,
) (*evmtypes.MsgEthereumTxResponse, error) {
nonce, err := k.authKeeper.GetSequence(ctx, from.Bytes())
if err != nil {
return nil, err
}
gasCap := config.DefaultGasCap
if commit && gasLimit == nil {
args, err := json.Marshal(evmtypes.TransactionArgs{
From: &from,
To: contract,
Data: (*hexutil.Bytes)(&data),
})
if err != nil {
return nil, cosmoserrors.Wrapf(sdkerrors.ErrJSONMarshal, "failed to marshal tx args: %s", err.Error())
}
gasRes, err := k.evmKeeper.EstimateGas(sdk.WrapSDKContext(ctx), &evmtypes.EthCallRequest{
Args: args,
GasCap: config.DefaultGasCap,
})
if err != nil {
return nil, err
}
gasCap = gasRes.Gas
k.Logger(ctx).Info("call evm", "EstimateGas", gasCap)
}
if gasLimit != nil {
gasCap = gasLimit.Uint64()
}
msg := ethtypes.NewMessage(
from,
contract,
nonce,
value, // amount
gasCap, // gasLimit
big.NewInt(0), // gasFeeCap
big.NewInt(0), // gasTipCap
big.NewInt(0), // gasPrice
data,
ethtypes.AccessList{}, // AccessList
!commit, // isFake
)
k.evmKeeper.WithChainID(ctx) //FIXME: set chainID for signer; should not need to do this; but seems necessary. Why?
k.Logger(ctx).Debug("call evm", "gasCap", gasCap, "chainid", k.evmKeeper.ChainID(), "ctx.chainid", ctx.ChainID())
res, err := k.evmKeeper.ApplyMessage(ctx, msg, evmtypes.NewNoOpTracer(), commit)
if err != nil {
return nil, err
}
if res.Failed() {
return res, cosmoserrors.Wrap(evmtypes.ErrVMExecution, fmt.Sprintf("%s: ret 0x%x", res.VmError, res.Ret))
}
// Emit events and log for the transaction if it is committed
if commit {
msgBytes, err := json.Marshal(msg)
if err != nil {
return nil, cosmoserrors.Wrap(err, "failed to encode msg")
}
ethTxHash := common.BytesToHash(crypto.Keccak256(msgBytes)) // NOTE(pwu): this is a fake txhash
attrs := []sdk.Attribute{}
if len(ctx.TxBytes()) > 0 {
// add event for tendermint transaction hash format
hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash())
ethTxHash = common.BytesToHash(hash) // NOTE(pwu): use cosmos tx hash as eth tx hash if available
attrs = append(attrs, sdk.NewAttribute(evmtypes.AttributeKeyTxHash, hash.String()))
}
attrs = append(attrs, []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyAmount, value.String()),
// add event for ethereum transaction hash format; NOTE(pwu): this is a fake txhash
sdk.NewAttribute(evmtypes.AttributeKeyEthereumTxHash, ethTxHash.String()),
// add event for index of valid ethereum tx; NOTE(pwu): fake txindex
sdk.NewAttribute(evmtypes.AttributeKeyTxIndex, strconv.FormatUint(8888, 10)),
// add event for eth tx gas used, we can't get it from cosmos tx result when it contains multiple eth tx msgs.
sdk.NewAttribute(evmtypes.AttributeKeyTxGasUsed, strconv.FormatUint(res.GasUsed, 10)),
}...)
// recipient: contract address
if contract != nil {
attrs = append(attrs, sdk.NewAttribute(evmtypes.AttributeKeyRecipient, contract.Hex()))
}
if res.Failed() {
attrs = append(attrs, sdk.NewAttribute(evmtypes.AttributeKeyEthereumTxFailed, res.VmError))
}
txLogAttrs := make([]sdk.Attribute, len(res.Logs))
for i, log := range res.Logs {
log.TxHash = ethTxHash.String()
value, err := json.Marshal(log)
if err != nil {
return nil, cosmoserrors.Wrap(err, "failed to encode log")
}
txLogAttrs[i] = sdk.NewAttribute(evmtypes.AttributeKeyTxLog, string(value))
}
if !noEthereumTxEvent {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
evmtypes.EventTypeEthereumTx,
attrs...,
),
sdk.NewEvent(
evmtypes.EventTypeTxLog,
txLogAttrs...,
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
sdk.NewAttribute(sdk.AttributeKeySender, from.Hex()),
sdk.NewAttribute(evmtypes.AttributeKeyTxType, "88"), // type 88: synthetic Eth tx
),
})
}
logs := evmtypes.LogsToEthereum(res.Logs)
var bloomReceipt ethtypes.Bloom
if len(logs) > 0 {
bloom := k.evmKeeper.GetBlockBloomTransient(ctx)
bloom.Or(bloom, big.NewInt(0).SetBytes(ethtypes.LogsBloom(logs)))
bloomReceipt = ethtypes.BytesToBloom(bloom.Bytes())
k.evmKeeper.SetBlockBloomTransient(ctx, bloomReceipt.Big())
k.evmKeeper.SetLogSizeTransient(ctx, (k.evmKeeper.GetLogSizeTransient(ctx))+uint64(len(logs)))
}
}
return res, nil
}
package keeper
import (
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
var _ evmtypes.EvmHooks = EVMHooks{}
type EVMHooks struct {
k Keeper
}
func (k Keeper) EVMHooks() EVMHooks {
return EVMHooks{k}
}
// PostTxProcessing is a wrapper for calling the EVM PostTxProcessing hook on the module keeper
func (h EVMHooks) PostTxProcessing(ctx sdk.Context, _ core.Message, receipt *ethtypes.Receipt) error {
return h.k.CheckPausedZRC20(ctx, receipt)
}
// CheckPausedZRC20 checks the events of the receipt
// if an event is emitted from a paused ZRC20 contract it will revert the transaction
func (k Keeper) CheckPausedZRC20(ctx sdk.Context, receipt *ethtypes.Receipt) error {
if receipt == nil {
return nil
}
// get non-duplicated list of all addresses that emitted logs
var addresses []ethcommon.Address
addressExist := make(map[ethcommon.Address]struct{})
for _, log := range receipt.Logs {
if log == nil {
continue
}
if _, ok := addressExist[log.Address]; !ok {
addressExist[log.Address] = struct{}{}
addresses = append(addresses, log.Address)
}
}
// check if any of the addresses are from a paused ZRC20 contract
for _, address := range addresses {
fc, found := k.GetForeignCoins(ctx, address.Hex())
if found && fc.Paused {
return cosmoserrors.Wrap(types.ErrPausedZRC20, address.Hex())
}
}
return nil
}
package keeper
import (
"fmt"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// SetForeignCoins set a specific foreignCoins in the store from its index
func (k Keeper) SetForeignCoins(ctx sdk.Context, foreignCoins types.ForeignCoins) {
p := types.KeyPrefix(fmt.Sprintf("%s", types.ForeignCoinsKeyPrefix))
store := prefix.NewStore(ctx.KVStore(k.storeKey), p)
b := k.cdc.MustMarshal(&foreignCoins)
store.Set(types.ForeignCoinsKey(
foreignCoins.Zrc20ContractAddress,
), b)
}
// GetForeignCoins returns a foreignCoins from its index
func (k Keeper) GetForeignCoins(
ctx sdk.Context,
zrc20Addr string,
) (val types.ForeignCoins, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(fmt.Sprintf("%s", types.ForeignCoinsKeyPrefix)))
b := store.Get(types.ForeignCoinsKey(
zrc20Addr,
))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveForeignCoins removes a foreignCoins from the store
func (k Keeper) RemoveForeignCoins(
ctx sdk.Context,
zrc20Addr string,
) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ForeignCoinsKeyPrefix))
store.Delete(types.ForeignCoinsKey(
zrc20Addr,
))
}
// GetAllForeignCoinsForChain returns all foreignCoins on a given chain
func (k Keeper) GetAllForeignCoinsForChain(ctx sdk.Context, foreignChainID int64) (list []types.ForeignCoins) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(fmt.Sprintf("%s", types.ForeignCoinsKeyPrefix)))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.ForeignCoins
k.cdc.MustUnmarshal(iterator.Value(), &val)
if val.ForeignChainId == foreignChainID {
list = append(list, val)
}
}
return
}
// GetAllForeignCoins returns all foreignCoins
func (k Keeper) GetAllForeignCoins(ctx sdk.Context) (list []types.ForeignCoins) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(fmt.Sprintf("%s", types.ForeignCoinsKeyPrefix)))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.ForeignCoins
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
// GetGasCoinForForeignCoin returns the gas coin for a given chain
func (k Keeper) GetGasCoinForForeignCoin(ctx sdk.Context, chainID int64) (types.ForeignCoins, bool) {
foreignCoinList := k.GetAllForeignCoinsForChain(ctx, chainID)
for _, coin := range foreignCoinList {
if coin.CoinType == common.CoinType_Gas {
return coin, true
}
}
return types.ForeignCoins{}, false
}
// GetForeignCoinFromAsset returns the foreign coin for a given asset for a given chain
func (k Keeper) GetForeignCoinFromAsset(ctx sdk.Context, asset string, chainID int64) (types.ForeignCoins, bool) {
if !ethcommon.IsHexAddress(asset) {
return types.ForeignCoins{}, false
}
assetAddr := ethcommon.HexToAddress(asset)
foreignCoinList := k.GetAllForeignCoinsForChain(ctx, chainID)
for _, coin := range foreignCoinList {
coinAssetAddr := ethcommon.HexToAddress(coin.Asset)
if coinAssetAddr == assetAddr && coin.ForeignChainId == chainID {
return coin, true
}
}
return types.ForeignCoins{}, false
}
package keeper
import (
"fmt"
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
systemcontract "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
uniswapv2router02 "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// SetupChainGasCoinAndPool setup gas ZRC20, and ZETA/gas pool for a chain
// add 0.1gas/0.1wzeta to the pool
// FIXME: add cointype and use proper gas limit based on cointype/chain
func (k Keeper) SetupChainGasCoinAndPool(
ctx sdk.Context,
chainID int64,
gasAssetName string,
symbol string,
decimals uint8,
gasLimit *big.Int,
) (ethcommon.Address, error) {
chain := common.GetChainFromChainID(chainID)
if chain == nil {
return ethcommon.Address{}, zetaObserverTypes.ErrSupportedChains
}
name := fmt.Sprintf("%s-%s", gasAssetName, chain.ChainName)
transferGasLimit := gasLimit
// default values
if transferGasLimit == nil {
transferGasLimit = big.NewInt(21_000)
if common.IsBitcoinChain(chain.ChainId) {
transferGasLimit = big.NewInt(100) // 100B for a typical tx
}
}
zrc20Addr, err := k.DeployZRC20Contract(ctx, name, symbol, decimals, chain.ChainId, common.CoinType_Gas, "", transferGasLimit)
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to DeployZRC20Contract")
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute(name, zrc20Addr.String()),
),
)
err = k.SetGasCoin(ctx, big.NewInt(chain.ChainId), zrc20Addr)
if err != nil {
return ethcommon.Address{}, err
}
amount := big.NewInt(10)
// #nosec G701 always in range
amount.Exp(amount, big.NewInt(int64(decimals-1)), nil)
amountAZeta := big.NewInt(1e17)
_, err = k.DepositZRC20(ctx, zrc20Addr, types.ModuleAddressEVM, amount)
if err != nil {
return ethcommon.Address{}, err
}
err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("azeta", sdk.NewIntFromBigInt(amountAZeta))))
if err != nil {
return ethcommon.Address{}, err
}
systemContractAddress, err := k.GetSystemContractAddress(ctx)
if err != nil || systemContractAddress == (ethcommon.Address{}) {
return ethcommon.Address{}, sdkerrors.Wrapf(types.ErrContractNotFound, "system contract address invalid: %s", systemContractAddress)
}
systemABI, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to get system contract abi")
}
_, err = k.CallEVM(ctx, *systemABI, types.ModuleAddressEVM, systemContractAddress, BigIntZero, nil, true, false, "setGasZetaPool", big.NewInt(chain.ChainId), zrc20Addr)
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to CallEVM method setGasZetaPool(%d, %s)", chain.ChainId, zrc20Addr.String())
}
// setup uniswap v2 pools gas/zeta
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to get uniswap router abi")
}
ZRC20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to GetAbi zrc20")
}
_, err = k.CallEVM(ctx, *ZRC20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, true, false, "approve", routerAddress, amount)
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to CallEVM method approve(%s, %d)", routerAddress.String(), amount)
}
//function addLiquidityETH(
// address token,
// uint amountTokenDesired,
// uint amountTokenMin,
// uint amountETHMin,
// address to,
// uint deadline
//) external payable returns (uint amountToken, uint amountETH, uint liquidity);
res, err := k.CallEVM(ctx, *routerABI, types.ModuleAddressEVM, routerAddress, amountAZeta, big.NewInt(5_000_000), true, false,
"addLiquidityETH", zrc20Addr, amount, BigIntZero, BigIntZero, types.ModuleAddressEVM, amountAZeta)
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to CallEVM method addLiquidityETH(%s, %s)", zrc20Addr.String(), amountAZeta.String())
}
AmountToken := new(*big.Int)
AmountETH := new(*big.Int)
Liquidity := new(*big.Int)
err = routerABI.UnpackIntoInterface(&[]interface{}{AmountToken, AmountETH, Liquidity}, "addLiquidityETH", res.Ret)
if err != nil {
return ethcommon.Address{}, sdkerrors.Wrapf(err, "failed to UnpackIntoInterface addLiquidityETH")
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(sdk.EventTypeMessage,
sdk.NewAttribute("function", "addLiquidityETH"),
sdk.NewAttribute("amountToken", (*AmountToken).String()),
sdk.NewAttribute("amountETH", (*AmountETH).String()),
sdk.NewAttribute("liquidity", (*Liquidity).String()),
),
)
return zrc20Addr, nil
}
package keeper
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
systemcontract "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// SetGasPrice sets gas price on the system contract in zEVM; return the gasUsed and error code
func (k Keeper) SetGasPrice(ctx sdk.Context, chainid *big.Int, gasPrice *big.Int) (uint64, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return 0, sdkerrors.Wrapf(types.ErrContractNotFound, "system contract state variable not found")
}
oracle := common.HexToAddress(system.SystemContract)
if oracle == common.HexToAddress("0x0") {
return 0, sdkerrors.Wrapf(types.ErrContractNotFound, "system contract invalid address")
}
abi, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return 0, sdkerrors.Wrapf(types.ErrABIGet, "SystemContractMetaData")
}
res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, oracle, BigIntZero, big.NewInt(50_000), true, false, "setGasPrice", chainid, gasPrice)
if err != nil {
return 0, sdkerrors.Wrapf(types.ErrContractCall, err.Error())
}
if res.Failed() {
return res.GasUsed, sdkerrors.Wrapf(types.ErrContractCall, "setGasPrice tx failed")
}
return res.GasUsed, nil
}
func (k Keeper) SetGasCoin(ctx sdk.Context, chainid *big.Int, address common.Address) error {
system, found := k.GetSystemContract(ctx)
if !found {
return sdkerrors.Wrapf(types.ErrContractNotFound, "system contract state variable not found")
}
oracle := common.HexToAddress(system.SystemContract)
if oracle == common.HexToAddress("0x0") {
return sdkerrors.Wrapf(types.ErrContractNotFound, "system contract invalid address")
}
abi, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return sdkerrors.Wrapf(types.ErrABIGet, "SystemContractMetaData")
}
res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, oracle, BigIntZero, nil, true, false, "setGasCoinZRC20", chainid, address)
if err != nil {
return sdkerrors.Wrapf(types.ErrContractCall, err.Error())
}
if res.Failed() {
return sdkerrors.Wrapf(types.ErrContractCall, "setGasCoinZRC20 tx failed")
}
return nil
}
func (k Keeper) SetGasZetaPool(ctx sdk.Context, chainid *big.Int, pool common.Address) error {
system, found := k.GetSystemContract(ctx)
if !found {
return sdkerrors.Wrapf(types.ErrContractNotFound, "system contract state variable not found")
}
oracle := common.HexToAddress(system.SystemContract)
if oracle == common.HexToAddress("0x0") {
return sdkerrors.Wrapf(types.ErrContractNotFound, "system contract invalid address")
}
abi, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return sdkerrors.Wrapf(types.ErrABIGet, "SystemContractMetaData")
}
res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, oracle, BigIntZero, nil, true, false, "setGasZetaPool", chainid, pool)
if err != nil {
return sdkerrors.Wrapf(types.ErrContractCall, err.Error())
}
if res.Failed() {
return sdkerrors.Wrapf(types.ErrContractCall, "setGasZetaPool tx failed")
}
return nil
}
package keeper
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// EnsureGasStabilityPoolAccountCreated ensures the gas stability pool account exists
func (k Keeper) EnsureGasStabilityPoolAccountCreated(ctx sdk.Context) {
address := types.GasStabilityPoolAddress()
ak := k.GetAuthKeeper()
accExists := ak.HasAccount(ctx, address)
if !accExists {
ak.SetAccount(ctx, ak.NewAccountWithAddress(ctx, address))
}
}
// GetGasStabilityPoolBalance returns the balance of the gas stability pool
func (k Keeper) GetGasStabilityPoolBalance(
ctx sdk.Context,
chainID int64,
) (*big.Int, error) {
// get the gas zrc20 contract from the chain
gasZRC20, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
if err != nil {
return nil, err
}
return k.BalanceOfZRC4(ctx, gasZRC20, types.GasStabilityPoolAddressEVM())
}
// FundGasStabilityPool mints the ZRC20 into a special address called gas stability pool for the chain
func (k Keeper) FundGasStabilityPool(
ctx sdk.Context,
chainID int64,
amount *big.Int,
) error {
k.EnsureGasStabilityPoolAccountCreated(ctx)
// get the gas zrc20 contract from the chain
gasZRC20, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
if err != nil {
return err
}
// call deposit ZRC20 method
return k.CallZRC20Deposit(
ctx,
types.ModuleAddressEVM,
gasZRC20,
types.GasStabilityPoolAddressEVM(),
amount,
)
}
// WithdrawFromGasStabilityPool burns the ZRC20 from the gas stability pool
func (k Keeper) WithdrawFromGasStabilityPool(
ctx sdk.Context,
chainID int64,
amount *big.Int,
) error {
k.EnsureGasStabilityPoolAccountCreated(ctx)
// get the gas zrc20 contract from the chain
gasZRC20, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
if err != nil {
return err
}
// call burn ZRC20 method
return k.CallZRC20Burn(
ctx,
types.GasStabilityPoolAddressEVM(),
gasZRC20,
amount,
false,
)
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/fungible/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) GasStabilityPoolAddress(
_ context.Context,
req *types.QueryGetGasStabilityPoolAddress,
) (*types.QueryGetGasStabilityPoolAddressResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
return &types.QueryGetGasStabilityPoolAddressResponse{
CosmosAddress: types.GasStabilityPoolAddress().String(),
EvmAddress: types.GasStabilityPoolAddressEVM().String(),
}, nil
}
func (k Keeper) GasStabilityPoolBalance(
c context.Context,
req *types.QueryGetGasStabilityPoolBalance,
) (*types.QueryGetGasStabilityPoolBalanceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
balance, err := k.GetGasStabilityPoolBalance(ctx, req.ChainId)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
if balance == nil {
return nil, status.Error(codes.NotFound, "no balance for the gas stability pool")
}
return &types.QueryGetGasStabilityPoolBalanceResponse{Balance: balance.String()}, nil
}
func (k Keeper) GasStabilityPoolBalanceAll(
c context.Context,
req *types.QueryAllGasStabilityPoolBalance,
) (*types.QueryAllGasStabilityPoolBalanceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
// iterate supported chains
chains := k.observerKeeper.GetParams(ctx).GetSupportedChains()
balances := make([]types.QueryAllGasStabilityPoolBalanceResponse_Balance, 0, len(chains))
for _, chain := range chains {
if chain == nil {
return nil, status.Error(codes.Internal, "invalid chain")
}
chainID := chain.ChainId
balance, err := k.GetGasStabilityPoolBalance(ctx, chainID)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
if balance == nil {
return nil, status.Error(codes.NotFound, "no balance for the gas stability pool")
}
balances = append(balances, types.QueryAllGasStabilityPoolBalanceResponse_Balance{
ChainId: chainID,
Balance: balance.String(),
})
}
return &types.QueryAllGasStabilityPoolBalanceResponse{
Balances: balances,
}, nil
}
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/fungible/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) ForeignCoinsAll(c context.Context, req *types.QueryAllForeignCoinsRequest) (*types.QueryAllForeignCoinsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var foreignCoinss []types.ForeignCoins
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
foreignCoinsStore := prefix.NewStore(store, types.KeyPrefix(types.ForeignCoinsKeyPrefix))
pageRes, err := query.Paginate(foreignCoinsStore, req.Pagination, func(key []byte, value []byte) error {
var foreignCoins types.ForeignCoins
if err := k.cdc.Unmarshal(value, &foreignCoins); err != nil {
return err
}
foreignCoinss = append(foreignCoinss, foreignCoins)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllForeignCoinsResponse{ForeignCoins: foreignCoinss, Pagination: pageRes}, nil
}
// Change this query to take Chain as well
func (k Keeper) ForeignCoins(c context.Context, req *types.QueryGetForeignCoinsRequest) (*types.QueryGetForeignCoinsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetForeignCoins(
ctx,
req.Index,
)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetForeignCoinsResponse{ForeignCoins: val}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/fungible/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/fungible/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) SystemContract(c context.Context, req *types.QueryGetSystemContractRequest) (*types.QueryGetSystemContractResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetSystemContract(ctx)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetSystemContractResponse{SystemContract: val}, nil
}
package keeper
import (
"fmt"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
type (
Keeper struct {
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
memKey storetypes.StoreKey
paramstore paramtypes.Subspace
authKeeper types.AccountKeeper
evmKeeper types.EVMKeeper
bankKeeper types.BankKeeper
observerKeeper types.ObserverKeeper
}
)
func NewKeeper(
cdc codec.BinaryCodec,
storeKey,
memKey storetypes.StoreKey,
ps paramtypes.Subspace,
authKeeper types.AccountKeeper,
evmKeeper types.EVMKeeper,
bankKeeper types.BankKeeper,
observerKeeper types.ObserverKeeper,
) *Keeper {
// set KeyTable if it has not already been set
if !ps.HasKeyTable() {
ps = ps.WithKeyTable(types.ParamKeyTable())
}
return &Keeper{
cdc: cdc,
storeKey: storeKey,
memKey: memKey,
paramstore: ps,
authKeeper: authKeeper,
evmKeeper: evmKeeper,
bankKeeper: bankKeeper,
observerKeeper: observerKeeper,
}
}
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
func (k Keeper) GetAuthKeeper() types.AccountKeeper {
return k.authKeeper
}
func (k Keeper) GetEVMKeeper() types.EVMKeeper {
return k.evmKeeper
}
func (k Keeper) GetBankKeeper() types.BankKeeper {
return k.bankKeeper
}
func (k Keeper) GetObserverKeeper() types.ObserverKeeper {
return k.observerKeeper
}
package keeper
import (
"github.com/zeta-chain/zetacore/x/fungible/types"
)
type msgServer struct {
Keeper
}
// NewMsgServerImpl returns an implementation of the MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}
var _ types.MsgServer = msgServer{}
package keeper
import (
"context"
"math/big"
"github.com/ethereum/go-ethereum/common"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
zetacommon "github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// DeployFungibleCoinZRC20 deploys a fungible coin from a connected chains as a ZRC20 on ZetaChain.
//
// If this is a gas coin, the following happens:
//
// * ZRC20 contract for the coin is deployed
// * contract address of ZRC20 is set as a token address in the system
// contract
// * ZETA tokens are minted and deposited into the module account
// * setGasZetaPool is called on the system contract to add the information
// about the pool to the system contract
// * addLiquidityETH is called to add liquidity to the pool
//
// If this is a non-gas coin, the following happens:
//
// * ZRC20 contract for the coin is deployed
// * The coin is added to the list of foreign coins in the module's state
//
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) DeployFungibleCoinZRC20(goCtx context.Context, msg *types.MsgDeployFungibleCoinZRC20) (*types.MsgDeployFungibleCoinZRC20Response, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
var address common.Address
var err error
if err = msg.ValidateBasic(); err != nil {
return nil, err
}
if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
}
if msg.CoinType == zetacommon.CoinType_Gas {
// #nosec G701 always in range
address, err = k.SetupChainGasCoinAndPool(ctx, msg.ForeignChainId, msg.Name, msg.Symbol, uint8(msg.Decimals), big.NewInt(msg.GasLimit))
if err != nil {
return nil, sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
} else {
// #nosec G701 always in range
address, err = k.DeployZRC20Contract(ctx, msg.Name, msg.Symbol, uint8(msg.Decimals), msg.ForeignChainId, msg.CoinType, msg.ERC20, big.NewInt(msg.GasLimit))
if err != nil {
return nil, err
}
}
err = ctx.EventManager().EmitTypedEvent(
&types.EventZRC20Deployed{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgDeployFungibleCoinZRC20{}),
ChainId: msg.ForeignChainId,
Contract: address.String(),
Name: msg.Name,
Symbol: msg.Symbol,
// #nosec G701 always in range
Decimals: int64(msg.Decimals),
CoinType: msg.CoinType,
Erc20: msg.ERC20,
GasLimit: msg.GasLimit,
},
)
if err != nil {
return nil, sdkerrors.Wrapf(err, "failed to emit event")
}
return &types.MsgDeployFungibleCoinZRC20Response{
Address: address.Hex(),
}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// RemoveForeignCoin removes a coin from the list of foreign coins in the module's state.
//
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) RemoveForeignCoin(goCtx context.Context, msg *types.MsgRemoveForeignCoin) (*types.MsgRemoveForeignCoinResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Removal can only be executed by the correct policy account")
}
index := msg.Name
_, found := k.GetForeignCoins(ctx, index)
if !found {
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "foreign coin not found")
}
k.RemoveForeignCoins(ctx, index)
return &types.MsgRemoveForeignCoinResponse{}, nil
}
package keeper
import (
"context"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// UpdateZRC20LiquidityCap updates the liquidity cap for a ZRC20 token.
func (k msgServer) UpdateZRC20LiquidityCap(goCtx context.Context, msg *types.MsgUpdateZRC20LiquidityCap) (*types.MsgUpdateZRC20LiquidityCapResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// check authorization
if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "update can only be executed by group 2 policy group")
}
// fetch the foreign coin
coin, found := k.GetForeignCoins(ctx, msg.Zrc20Address)
if !found {
return nil, types.ErrForeignCoinNotFound
}
// update the liquidity cap
coin.LiquidityCap = msg.LiquidityCap
k.SetForeignCoins(ctx, coin)
return &types.MsgUpdateZRC20LiquidityCapResponse{}, nil
}
package keeper
import (
"context"
cosmoserror "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// UpdateContractBytecode updates the bytecode of a contract from the bytecode of an existing contract
// Only a ZRC20 contract or the WZeta connector contract can be updated
// IMPORTANT: the new contract bytecode must have the same storage layout as the old contract bytecode
// the new contract can add new variable but cannot remove any existing variable
func (k msgServer) UpdateContractBytecode(goCtx context.Context, msg *types.MsgUpdateContractBytecode) (*types.MsgUpdateContractBytecodeResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// check authorization
if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group2) {
return nil, cosmoserror.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
}
// fetch account to update
if !ethcommon.IsHexAddress(msg.ContractAddress) {
return nil, cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress)
}
contractAddress := ethcommon.HexToAddress(msg.ContractAddress)
acct := k.evmKeeper.GetAccount(ctx, contractAddress)
if acct == nil {
return nil, cosmoserror.Wrapf(types.ErrContractNotFound, "contract (%s) not found", contractAddress.Hex())
}
// check the contract is a zrc20
_, found := k.GetForeignCoins(ctx, msg.ContractAddress)
if !found {
// check contract is wzeta connector contract
systemContract, found := k.GetSystemContract(ctx)
if !found {
return nil, types.ErrSystemContractNotFound
}
if msg.ContractAddress != systemContract.ConnectorZevm {
// not a zrc20 or wzeta connector contract, can't be updated
return nil, cosmoserror.Wrapf(types.ErrInvalidContract, "contract (%s) is neither a zrc20 nor wzeta connector", msg.ContractAddress)
}
}
// fetch the account of the new bytecode
if !ethcommon.IsHexAddress(msg.NewBytecodeAddress) {
return nil, cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.NewBytecodeAddress)
}
newBytecodeAddress := ethcommon.HexToAddress(msg.NewBytecodeAddress)
newBytecodeAcct := k.evmKeeper.GetAccount(ctx, newBytecodeAddress)
if newBytecodeAcct == nil {
return nil, cosmoserror.Wrapf(types.ErrContractNotFound, "contract (%s) not found", newBytecodeAddress.Hex())
}
// set the new CodeHash to the account
previousCodeHash := acct.CodeHash
acct.CodeHash = newBytecodeAcct.CodeHash
err := k.evmKeeper.SetAccount(ctx, contractAddress, *acct)
if err != nil {
return nil, cosmoserror.Wrapf(
types.ErrSetBytecode,
"failed to update contract (%s) bytecode (%s)",
contractAddress.Hex(),
err.Error(),
)
}
k.Logger(ctx).Info(
"updated contract bytecode",
"contract", contractAddress.Hex(),
"oldCodeHash", string(previousCodeHash),
"newCodeHash", string(acct.CodeHash),
)
return &types.MsgUpdateContractBytecodeResponse{
NewBytecodeHash: acct.CodeHash,
}, nil
}
package keeper
import (
"context"
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
func (k msgServer) UpdateSystemContract(goCtx context.Context, msg *types.MsgUpdateSystemContract) (*types.MsgUpdateSystemContractResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
}
newSystemContractAddr := ethcommon.HexToAddress(msg.NewSystemContractAddress)
if newSystemContractAddr == (ethcommon.Address{}) {
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress)
}
// update contracts
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, sdkerrors.Wrapf(types.ErrABIGet, "failed to get zrc20 abi")
}
sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return nil, sdkerrors.Wrapf(types.ErrABIGet, "failed to get system contract abi")
}
foreignCoins := k.GetAllForeignCoins(ctx)
tmpCtx, commit := ctx.CacheContext()
for _, fcoin := range foreignCoins {
zrc20Addr := ethcommon.HexToAddress(fcoin.Zrc20ContractAddress)
if zrc20Addr == (ethcommon.Address{}) {
k.Logger(ctx).Error("invalid zrc20 contract address", "address", fcoin.Zrc20ContractAddress)
continue
}
_, err = k.CallEVM(tmpCtx, *zrc20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, true, false, "updateSystemContractAddress", newSystemContractAddr)
if err != nil {
return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract method updateSystemContractAddress (%s)", err.Error())
}
if fcoin.CoinType == common.CoinType_Gas {
_, err = k.CallEVM(tmpCtx, *sysABI, types.ModuleAddressEVM, newSystemContractAddr, BigIntZero, nil, true, false, "setGasCoinZRC20", big.NewInt(fcoin.ForeignChainId), zrc20Addr)
if err != nil {
return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to call system contract method setGasCoinZRC20 (%s)", err.Error())
}
_, err = k.CallEVM(tmpCtx, *sysABI, types.ModuleAddressEVM, newSystemContractAddr, BigIntZero, nil, true, false, "setGasZetaPool", big.NewInt(fcoin.ForeignChainId), zrc20Addr)
if err != nil {
return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to call system contract method setGasZetaPool (%s)", err.Error())
}
}
}
sys, found := k.GetSystemContract(ctx)
if !found {
k.Logger(ctx).Error("system contract not found")
}
oldSystemContractAddress := sys.SystemContract
sys.SystemContract = newSystemContractAddr.Hex()
k.SetSystemContract(ctx, sys)
err = ctx.EventManager().EmitTypedEvent(
&types.EventSystemContractUpdated{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateSystemContract{}),
NewContractAddress: msg.NewSystemContractAddress,
OldContractAddress: oldSystemContractAddress,
Signer: msg.Creator,
},
)
if err != nil {
k.Logger(ctx).Error("failed to emit event", "error", err.Error())
return nil, sdkerrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error())
}
commit()
return &types.MsgUpdateSystemContractResponse{}, nil
}
package keeper
import (
"context"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
// UpdateZRC20PausedStatus updates the paused status of a ZRC20
// The list of ZRC20s are either paused or unpaused
func (k msgServer) UpdateZRC20PausedStatus(
goCtx context.Context,
msg *types.MsgUpdateZRC20PausedStatus,
) (*types.MsgUpdateZRC20PausedStatusResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// check message validity
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
// check if the sender is the admin
// unpausing requires group2 admin
requirePolicyAccount := zetaObserverTypes.Policy_Type_group1
if msg.Action == types.UpdatePausedStatusAction_UNPAUSE {
requirePolicyAccount = zetaObserverTypes.Policy_Type_group2
}
if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(requirePolicyAccount) {
return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account")
}
pausedStatus := true
if msg.Action == types.UpdatePausedStatusAction_UNPAUSE {
pausedStatus = false
}
// iterate all foreign coins and set paused status
for _, zrc20 := range msg.Zrc20Addresses {
fc, found := k.GetForeignCoins(ctx, zrc20)
if !found {
return nil, cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "foreign coin not found %s", zrc20)
}
fc.Paused = pausedStatus
k.SetForeignCoins(ctx, fc)
}
err := ctx.EventManager().EmitTypedEvent(
&types.EventZRC20PausedStatusUpdated{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateZRC20PausedStatus{}),
Action: msg.Action,
Zrc20Addresses: msg.Zrc20Addresses,
Signer: msg.Creator,
},
)
if err != nil {
k.Logger(ctx).Error("failed to emit event",
"event", "EventZRC20PausedStatusUpdated",
"error", err.Error(),
)
return nil, cosmoserrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error())
}
return &types.MsgUpdateZRC20PausedStatusResponse{}, nil
}
package keeper
import (
"context"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/x/fungible/types"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
func (k msgServer) UpdateZRC20WithdrawFee(goCtx context.Context, msg *types.MsgUpdateZRC20WithdrawFee) (*types.MsgUpdateZRC20WithdrawFeeResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// check signer permission
if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "deploy can only be executed by the correct policy account")
}
// check the zrc20 exists
zrc20Addr := ethcommon.HexToAddress(msg.Zrc20Address)
if zrc20Addr == (ethcommon.Address{}) {
return nil, cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", msg.Zrc20Address)
}
coin, found := k.GetForeignCoins(ctx, msg.Zrc20Address)
if !found {
return nil, cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "no foreign coin match requested zrc20 address (%s)", msg.Zrc20Address)
}
// get the previous fee
oldWithdrawFee, err := k.QueryProtocolFlatFee(ctx, zrc20Addr)
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to query protocol flat fee (%s)", err.Error())
}
oldGasLimit, err := k.QueryGasLimit(ctx, zrc20Addr)
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to query gas limit (%s)", err.Error())
}
// call the contract methods
tmpCtx, commit := ctx.CacheContext()
if !msg.NewWithdrawFee.IsNil() {
_, err = k.UpdateZRC20ProtocolFlatFee(tmpCtx, zrc20Addr, msg.NewWithdrawFee.BigInt())
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract updateProtocolFlatFee method (%s)", err.Error())
}
}
if !msg.NewGasLimit.IsNil() {
_, err = k.UpdateZRC20GasLimit(tmpCtx, zrc20Addr, msg.NewGasLimit.BigInt())
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract updateGasLimit method (%s)", err.Error())
}
}
err = ctx.EventManager().EmitTypedEvent(
&types.EventZRC20WithdrawFeeUpdated{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateZRC20WithdrawFee{}),
ChainId: coin.ForeignChainId,
CoinType: coin.CoinType,
Zrc20Address: zrc20Addr.Hex(),
OldWithdrawFee: oldWithdrawFee.String(),
NewWithdrawFee: msg.NewWithdrawFee.String(),
Signer: msg.Creator,
OldGasLimit: oldGasLimit.String(),
NewGasLimit: msg.NewGasLimit.String(),
},
)
if err != nil {
k.Logger(ctx).Error("failed to emit event", "error", err.Error())
return nil, cosmoserrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error())
}
commit()
return &types.MsgUpdateZRC20WithdrawFeeResponse{}, nil
}
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(_ sdk.Context) types.Params {
return types.NewParams()
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, ¶ms)
}
package keeper
import (
"math/big"
cosmoserrors "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/wzeta.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
"github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// SetSystemContract set system contract in the store
func (k Keeper) SetSystemContract(ctx sdk.Context, sytemContract types.SystemContract) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SystemContractKey))
b := k.cdc.MustMarshal(&sytemContract)
store.Set([]byte{0}, b)
}
// GetSystemContract returns system contract from the store
func (k Keeper) GetSystemContract(ctx sdk.Context) (val types.SystemContract, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SystemContractKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveSystemContract removes system contract from the store
func (k Keeper) RemoveSystemContract(ctx sdk.Context) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SystemContractKey))
store.Delete([]byte{0})
}
// GetSystemContractAddress returns the system contract address
// TODO : wzetaContractAddress and other constant strings , can be declared as a constant string in types
// TODO Remove repetitive code
func (k *Keeper) GetSystemContractAddress(ctx sdk.Context) (ethcommon.Address, error) {
// set the system contract
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
return systemAddress, nil
}
// GetWZetaContractAddress returns the wzeta contract address on ZetaChain
func (k *Keeper) GetWZetaContractAddress(ctx sdk.Context) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
}
res, err := k.CallEVM(
ctx,
*sysABI,
types.ModuleAddressEVM,
systemAddress,
BigIntZero,
nil,
false,
false,
"wZetaContractAddress",
)
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call wZetaContractAddress")
}
type AddressResponse struct {
Value ethcommon.Address
}
var wzetaResponse AddressResponse
if err := sysABI.UnpackIntoInterface(&wzetaResponse, "wZetaContractAddress", res.Ret); err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack wZetaContractAddress: %s", err.Error())
}
return wzetaResponse.Value, nil
}
// GetUniswapV2FactoryAddress returns the uniswapv2 factory contract address on ZetaChain
func (k *Keeper) GetUniswapV2FactoryAddress(ctx sdk.Context) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
}
res, err := k.CallEVM(
ctx,
*sysABI,
types.ModuleAddressEVM,
systemAddress,
BigIntZero,
nil,
false,
false,
"uniswapv2FactoryAddress",
)
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call uniswapv2FactoryAddress")
}
type AddressResponse struct {
Value ethcommon.Address
}
var wzetaResponse AddressResponse
if err := sysABI.UnpackIntoInterface(&wzetaResponse, "uniswapv2FactoryAddress", res.Ret); err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack uniswapv2FactoryAddress: %s", err.Error())
}
return wzetaResponse.Value, nil
}
// GetUniswapV2Router02Address returns the uniswapv2 router02 address on ZetaChain
func (k *Keeper) GetUniswapV2Router02Address(ctx sdk.Context) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
}
res, err := k.CallEVM(
ctx,
*sysABI,
types.ModuleAddressEVM,
systemAddress,
BigIntZero,
nil,
false,
false,
"uniswapv2Router02Address",
)
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call uniswapv2Router02Address")
}
type AddressResponse struct {
Value ethcommon.Address
}
var routerResponse AddressResponse
if err := sysABI.UnpackIntoInterface(&routerResponse, "uniswapv2Router02Address", res.Ret); err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack uniswapv2Router02Address: %s", err.Error())
}
return routerResponse.Value, nil
}
// CallWZetaDeposit calls the deposit method of the wzeta contract
func (k *Keeper) CallWZetaDeposit(ctx sdk.Context, sender ethcommon.Address, amount *big.Int) error {
wzetaAddress, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return cosmoserrors.Wrapf(err, "failed to get wzeta contract address")
}
abi, err := wzeta.WETH9MetaData.GetAbi()
if err != nil {
return err
}
gasLimit := big.NewInt(70_000) // for some reason, GasEstimate for this contract call is always insufficient
_, err = k.CallEVM(
ctx,
*abi,
sender,
wzetaAddress,
amount,
gasLimit,
true,
false,
"deposit",
)
if err != nil {
return cosmoserrors.Wrapf(err, "failed to call wzeta deposit")
}
return nil
}
// QueryWZetaBalanceOf returns the balance of the given address in the wzeta contract
func (k *Keeper) QueryWZetaBalanceOf(ctx sdk.Context, addr ethcommon.Address) (*big.Int, error) {
wzetaAddress, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get wzeta contract address")
}
wzetaABI, err := wzeta.WETH9MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get ABI")
}
res, err := k.CallEVM(
ctx,
*wzetaABI,
addr,
wzetaAddress,
big.NewInt(0),
nil,
false,
false,
"balanceOf",
addr,
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to call balanceOf")
}
type BigIntResponse struct {
Value *big.Int
}
var balanceResponse BigIntResponse
if err := wzetaABI.UnpackIntoInterface(&balanceResponse, "balanceOf", res.Ret); err != nil {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack balanceOf: %s", err.Error())
}
return balanceResponse.Value, nil
}
// QuerySystemContractGasCoinZRC20 returns the gas coin zrc20 address for the given chain id
func (k *Keeper) QuerySystemContractGasCoinZRC20(ctx sdk.Context, chainid *big.Int) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
}
res, err := k.CallEVM(
ctx,
*sysABI,
types.ModuleAddressEVM,
systemAddress,
BigIntZero,
nil,
false,
false,
"gasCoinZRC20ByChainId",
chainid,
)
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call gasCoinZRC20ByChainId")
}
type AddressResponse struct {
Value ethcommon.Address
}
var zrc20Res AddressResponse
if err := sysABI.UnpackIntoInterface(&zrc20Res, "gasCoinZRC20ByChainId", res.Ret); err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack gasCoinZRC20ByChainId: %s", err.Error())
}
return zrc20Res.Value, nil
}
// CallUniswapV2RouterSwapExactTokensForTokens calls the swapExactTokensForETH method of the uniswapv2 router contract
// to swap tokens to another tokens using wZeta as intermediary
func (k *Keeper) CallUniswapV2RouterSwapExactTokensForTokens(
ctx sdk.Context,
sender ethcommon.Address,
to ethcommon.Address,
amountIn *big.Int,
inZRC4,
outZRC4 ethcommon.Address,
noEthereumTxEvent bool,
) (ret []*big.Int, err error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
//function swapExactTokensForTokens(
// uint amountIn,
// uint amountOutMin,
// address[] calldata path,
// address to,
// uint deadline
//)
res, err := k.CallEVM(
ctx,
*routerABI,
sender,
routerAddress,
BigIntZero,
big.NewInt(1000_000),
true,
noEthereumTxEvent,
"swapExactTokensForTokens",
amountIn,
BigIntZero,
[]ethcommon.Address{inZRC4, wzetaAddr, outZRC4},
to,
big.NewInt(1e17),
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapExactTokensForTokens")
}
amounts := new([3]*big.Int)
err = routerABI.UnpackIntoInterface(&amounts, "swapExactTokensForTokens", res.Ret)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to UnpackIntoInterface swapExactTokensForTokens")
}
return (*amounts)[:], nil
}
// CallUniswapV2RouterSwapExactTokensForETH calls the swapExactTokensForETH method of the uniswapv2 router contract
func (k *Keeper) CallUniswapV2RouterSwapExactTokensForETH(
ctx sdk.Context,
sender ethcommon.Address,
to ethcommon.Address,
amountIn *big.Int,
inZRC4 ethcommon.Address,
noEthereumTxEvent bool,
) (ret []*big.Int, err error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
//function swapExactTokensForETH(
// uint amountIn,
// uint amountOutMin,
// address[] calldata path,
// address to,
// uint deadline
//)
ctx.Logger().Error("Calling swapExactTokensForETH")
res, err := k.CallEVM(
ctx,
*routerABI,
sender,
routerAddress,
BigIntZero,
big.NewInt(300_000),
true,
noEthereumTxEvent,
"swapExactTokensForETH",
amountIn,
BigIntZero,
[]ethcommon.Address{inZRC4, wzetaAddr},
to,
big.NewInt(1e17),
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapExactTokensForETH")
}
amounts := new([2]*big.Int)
err = routerABI.UnpackIntoInterface(&amounts, "swapExactTokensForETH", res.Ret)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to UnpackIntoInterface swapExactTokensForETH")
}
return (*amounts)[:], nil
}
// CallUniswapV2RouterSwapExactETHForToken calls the swapExactETHForTokens method of the uniswapv2 router contract
func (k *Keeper) CallUniswapV2RouterSwapExactETHForToken(
ctx sdk.Context,
sender ethcommon.Address,
to ethcommon.Address,
amountIn *big.Int,
outZRC4 ethcommon.Address,
noEthereumTxEvent bool,
) ([]*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
//function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable
//returns (uint[] memory amounts);
res, err := k.CallEVM(
ctx,
*routerABI,
sender,
routerAddress,
amountIn,
big.NewInt(300_000),
true,
noEthereumTxEvent,
"swapExactETHForTokens",
BigIntZero,
[]ethcommon.Address{wzetaAddr, outZRC4},
to,
big.NewInt(1e17),
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapExactETHForTokens")
}
amounts := new([2]*big.Int)
err = routerABI.UnpackIntoInterface(&amounts, "swapExactETHForTokens", res.Ret)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to UnpackIntoInterface swapExactETHForTokens")
}
return (*amounts)[:], nil
}
// CallUniswapV2RouterSwapEthForExactToken calls the swapETHForExactTokens method of the uniswapv2 router contract
func (k *Keeper) CallUniswapV2RouterSwapEthForExactToken(
ctx sdk.Context,
sender ethcommon.Address,
to ethcommon.Address,
maxAmountIn *big.Int,
amountOut *big.Int,
outZRC4 ethcommon.Address,
) ([]*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
//function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
//returns (uint[] memory amounts);
res, err := k.CallEVM(
ctx,
*routerABI,
sender,
routerAddress,
maxAmountIn,
big.NewInt(300_000),
true,
false,
"swapETHForExactTokens",
amountOut,
[]ethcommon.Address{wzetaAddr, outZRC4},
to,
big.NewInt(1e17),
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapETHForExactTokens")
}
amounts := new([2]*big.Int)
err = routerABI.UnpackIntoInterface(&amounts, "swapETHForExactTokens", res.Ret)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to unpack swapETHForExactTokens")
}
return (*amounts)[:], nil
}
// QueryUniswapV2RouterGetZetaAmountsIn returns the amount of zeta needed to buy the given amount of ZRC4 tokens
func (k *Keeper) QueryUniswapV2RouterGetZetaAmountsIn(ctx sdk.Context, amountOut *big.Int, outZRC4 ethcommon.Address) (*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
//function getAmountsIn(uint amountOut, address[] memory path) public view returns (uint[] memory amounts);
k.Logger(ctx).Info("getAmountsIn", "outZRC20", outZRC4.Hex(), "amountOut", amountOut, "wzeta", wzetaAddr.Hex())
res, err := k.CallEVM(
ctx,
*routerABI,
types.ModuleAddressEVM,
routerAddress,
BigIntZero,
nil,
false,
false,
"getAmountsIn",
amountOut,
[]ethcommon.Address{wzetaAddr, outZRC4},
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method getAmountsIn")
}
amounts := new([2]*big.Int)
err = routerABI.UnpackIntoInterface(&amounts, "getAmountsIn", res.Ret)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to unpack getAmountsIn")
}
return (*amounts)[0], nil
}
// QueryUniswapV2RouterGetZRC4AmountsIn returns the amount of ZRC4 tokens needed to buy the given amount of zeta
func (k *Keeper) QueryUniswapV2RouterGetZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4 ethcommon.Address) (*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
//function getAmountsIn(uint amountOut, address[] memory path) public view returns (uint[] memory amounts);
res, err := k.CallEVM(
ctx,
*routerABI,
types.ModuleAddressEVM,
routerAddress,
BigIntZero,
nil,
false,
false,
"getAmountsIn",
amountOut,
[]ethcommon.Address{inZRC4, wzetaAddr},
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method getAmountsIn")
}
amounts := new([2]*big.Int)
err = routerABI.UnpackIntoInterface(&amounts, "getAmountsIn", res.Ret)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to unpack getAmountsIn")
}
return (*amounts)[0], nil
}
// QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn returns the amount of ZRC4 tokens needed to buy another ZRC4 token, it uses the WZeta contract as a bridge
func (k *Keeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4, outZRC4 ethcommon.Address) (*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
//function getAmountsIn(uint amountOut, address[] memory path) public view returns (uint[] memory amounts);
res, err := k.CallEVM(
ctx,
*routerABI,
types.ModuleAddressEVM,
routerAddress,
BigIntZero,
nil,
false,
false,
"getAmountsIn",
amountOut,
[]ethcommon.Address{inZRC4, wzetaAddr, outZRC4},
)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method getAmountsIn")
}
amounts := new([3]*big.Int)
err = routerABI.UnpackIntoInterface(&amounts, "getAmountsIn", res.Ret)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to unpack getAmountsIn")
}
return (*amounts)[0], nil
}
// CallZRC20Burn calls the burn method of the zrc20 contract
func (k *Keeper) CallZRC20Burn(
ctx sdk.Context,
sender ethcommon.Address,
zrc20address ethcommon.Address,
amount *big.Int,
noEthereumTxEvent bool,
) error {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return cosmoserrors.Wrapf(err, "failed to get zrc20 abi")
}
_, err = k.CallEVM(
ctx,
*zrc20ABI,
sender,
zrc20address,
big.NewInt(0),
big.NewInt(100_000),
true,
noEthereumTxEvent,
"burn",
amount,
)
if err != nil {
return cosmoserrors.Wrapf(err, "failed to CallEVM method burn")
}
return nil
}
// CallZRC20Deposit calls the deposit method of the zrc20 contract
func (k *Keeper) CallZRC20Deposit(
ctx sdk.Context,
sender ethcommon.Address,
zrc20address ethcommon.Address,
to ethcommon.Address,
amount *big.Int,
) error {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return cosmoserrors.Wrapf(err, "failed to get zrc20 abi")
}
_, err = k.CallEVM(
ctx,
*zrc20ABI,
sender,
zrc20address,
big.NewInt(0),
big.NewInt(100_000),
true,
false,
"deposit",
to,
amount,
)
if err != nil {
return cosmoserrors.Wrapf(err, "failed to CallEVM method burn")
}
return nil
}
// CallZRC20Approve calls the approve method of the zrc20 contract
func (k *Keeper) CallZRC20Approve(
ctx sdk.Context,
owner ethcommon.Address,
zrc20address ethcommon.Address,
spender ethcommon.Address,
amount *big.Int,
noEthereumTxEvent bool,
) error {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return cosmoserrors.Wrapf(err, "failed to get zrc20 abi")
}
_, err = k.CallEVM(
ctx,
*zrc20ABI,
owner,
zrc20address,
BigIntZero,
nil,
true,
noEthereumTxEvent,
"approve",
spender,
amount,
)
if err != nil {
return cosmoserrors.Wrapf(err, "failed to CallEVM method approve")
}
return nil
}
package keeper
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// MintZetaToEVMAccount mints ZETA (gas token) to the given address
// NOTE: this method should be used with a temporary context, and it should not be committed if the method returns an error
func (k *Keeper) MintZetaToEVMAccount(ctx sdk.Context, to sdk.AccAddress, amount *big.Int) error {
coins := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewIntFromBigInt(amount)))
// Mint coins
if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins); err != nil {
return err
}
// Send minted coins to the receiver
return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, to, coins)
}
package fungible
import (
"context"
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/zeta-chain/zetacore/x/fungible/client/cli"
"github.com/zeta-chain/zetacore/x/fungible/keeper"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
)
// ----------------------------------------------------------------------------
// AppModuleBasic
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the fungible module.
type AppModuleBasic struct {
cdc codec.BinaryCodec
}
func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic {
return AppModuleBasic{cdc: cdc}
}
// Name returns the fungible module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
}
func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
// RegisterInterfaces registers the module's interface types
func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}
// DefaultGenesis returns the fungible module's default genesis state.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesis())
}
// ValidateGenesis performs genesis state validation for the fungible module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return genState.Validate()
}
// RegisterRESTRoutes registers the fungible module's REST service handlers.
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {
fmt.Println("RegisterQueryHandlerClient err: %w", err)
}
}
// GetTxCmd returns the fungible module's root tx command.
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}
// GetQueryCmd returns the fungible module's root query command.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(types.StoreKey)
}
// ----------------------------------------------------------------------------
// AppModule
// ----------------------------------------------------------------------------
// AppModule implements the AppModule interface for the fungible module.
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
accountKeeper types.AccountKeeper
bankKeeper types.BankKeeper
}
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
}
}
// Name returns the fungible module's name.
func (am AppModule) Name() string {
return am.AppModuleBasic.Name()
}
// Route returns the fungible module's message routing key.
func (am AppModule) Route() sdk.Route {
return sdk.Route{}
}
// QuerierRoute returns the fungible module's query routing key.
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
// LegacyQuerierHandler returns the fungible module's Querier.
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
}
// RegisterInvariants registers the fungible module's invariants.
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// InitGenesis performs the fungible module's genesis initialization It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate {
var genState types.GenesisState
// Initialize global index to index in genesis state
cdc.MustUnmarshalJSON(gs, &genState)
InitGenesis(ctx, am.keeper, genState)
// ensure fungible module account is set on genesis
if acc := am.accountKeeper.GetModuleAccount(ctx, types.ModuleName); acc == nil {
// NOTE: shouldn't occur
panic("the fungible module account has not been set")
}
return []abci.ValidatorUpdate{}
}
// ExportGenesis returns the fungible module's exported genesis state as raw JSON bytes.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
genState := ExportGenesis(ctx, am.keeper)
return cdc.MustMarshalJSON(genState)
}
// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 2 }
// BeginBlock executes all ABCI BeginBlock logic respective to the fungible module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
//TODO : moved to init-genesis
// https://github.com/zeta-chain/node/issues/866
if ctx.BlockHeight() == 1 {
err := am.keeper.BlockOneDeploySystemContracts(sdk.WrapSDKContext(ctx))
if err != nil {
ctx.Logger().Error("Unable To deploy contracts", "err", err.Error())
}
}
if ctx.BlockHeight() == 20 {
err := am.keeper.TestUpdateSystemContractAddress(sdk.WrapSDKContext(ctx))
if err != nil {
ctx.Logger().Error("Unable To update system contracts", "err", err.Error())
} else {
ctx.Logger().Info("System contract updated")
}
}
if ctx.BlockHeight() == 25 {
err := am.keeper.TestUpdateZRC20WithdrawFee(sdk.WrapSDKContext(ctx))
if err != nil {
ctx.Logger().Error("Unable To update zrc20 withdraw fee", "err", err.Error())
} else {
ctx.Logger().Info("zrc20 withdraw fee updated")
}
}
}
// EndBlock executes all ABCI EndBlock logic respective to the fungible module. It
// returns no validator updates.
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}
package fungible
import (
"math/rand"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
// GenerateGenesisState creates a randomized GenState of the module
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
accs := make([]string, len(simState.Accounts))
for i, acc := range simState.Accounts {
accs[i] = acc.Address.String()
}
fungibleGenesis := types.GenesisState{
Params: types.DefaultParams(),
}
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&fungibleGenesis)
}
// ProposalContents doesn't return any content functions for governance proposals
func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent {
return nil
}
// RandomizedParams creates randomized param changes for the simulator
func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange {
return []simtypes.ParamChange{}
}
// RegisterStoreDecoder registers a decoder
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {}
// WeightedOperations returns the all the gov module operations with their respective weights.
func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
operations := make([]simtypes.WeightedOperation, 0)
return operations
}
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgDeployFungibleCoinZRC20{}, "fungible/DeployFungibleCoinZRC20", nil)
cdc.RegisterConcrete(&MsgRemoveForeignCoin{}, "fungible/RemoveForeignCoin", nil)
cdc.RegisterConcrete(&MsgUpdateSystemContract{}, "fungible/UpdateSystemContract", nil)
cdc.RegisterConcrete(&MsgUpdateZRC20WithdrawFee{}, "fungible/UpdateZRC20WithdrawFee", nil)
cdc.RegisterConcrete(&MsgUpdateContractBytecode{}, "fungible/UpdateContractBytecode", nil)
cdc.RegisterConcrete(&MsgUpdateZRC20PausedStatus{}, "fungible/UpdateZRC20PausedStatus", nil)
cdc.RegisterConcrete(&MsgUpdateZRC20LiquidityCap{}, "fungible/UpdateZRC20LiquidityCap", nil)
}
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgDeployFungibleCoinZRC20{},
&MsgRemoveForeignCoin{},
&MsgUpdateSystemContract{},
&MsgUpdateZRC20WithdrawFee{},
&MsgUpdateContractBytecode{},
&MsgUpdateZRC20PausedStatus{},
&MsgUpdateZRC20LiquidityCap{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
var (
Amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: fungible/events.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type EventSystemContractUpdated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
NewContractAddress string `protobuf:"bytes,2,opt,name=new_contract_address,json=newContractAddress,proto3" json:"new_contract_address,omitempty"`
OldContractAddress string `protobuf:"bytes,3,opt,name=old_contract_address,json=oldContractAddress,proto3" json:"old_contract_address,omitempty"`
Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"`
}
func (m *EventSystemContractUpdated) Reset() { *m = EventSystemContractUpdated{} }
func (m *EventSystemContractUpdated) String() string { return proto.CompactTextString(m) }
func (*EventSystemContractUpdated) ProtoMessage() {}
func (*EventSystemContractUpdated) Descriptor() ([]byte, []int) {
return fileDescriptor_858e6494730deffd, []int{0}
}
func (m *EventSystemContractUpdated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventSystemContractUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventSystemContractUpdated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventSystemContractUpdated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventSystemContractUpdated.Merge(m, src)
}
func (m *EventSystemContractUpdated) XXX_Size() int {
return m.Size()
}
func (m *EventSystemContractUpdated) XXX_DiscardUnknown() {
xxx_messageInfo_EventSystemContractUpdated.DiscardUnknown(m)
}
var xxx_messageInfo_EventSystemContractUpdated proto.InternalMessageInfo
func (m *EventSystemContractUpdated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventSystemContractUpdated) GetNewContractAddress() string {
if m != nil {
return m.NewContractAddress
}
return ""
}
func (m *EventSystemContractUpdated) GetOldContractAddress() string {
if m != nil {
return m.OldContractAddress
}
return ""
}
func (m *EventSystemContractUpdated) GetSigner() string {
if m != nil {
return m.Signer
}
return ""
}
type EventZRC20Deployed struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Symbol string `protobuf:"bytes,5,opt,name=symbol,proto3" json:"symbol,omitempty"`
Decimals int64 `protobuf:"varint,6,opt,name=decimals,proto3" json:"decimals,omitempty"`
CoinType common.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
Erc20 string `protobuf:"bytes,8,opt,name=erc20,proto3" json:"erc20,omitempty"`
GasLimit int64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
}
func (m *EventZRC20Deployed) Reset() { *m = EventZRC20Deployed{} }
func (m *EventZRC20Deployed) String() string { return proto.CompactTextString(m) }
func (*EventZRC20Deployed) ProtoMessage() {}
func (*EventZRC20Deployed) Descriptor() ([]byte, []int) {
return fileDescriptor_858e6494730deffd, []int{1}
}
func (m *EventZRC20Deployed) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventZRC20Deployed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventZRC20Deployed.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventZRC20Deployed) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventZRC20Deployed.Merge(m, src)
}
func (m *EventZRC20Deployed) XXX_Size() int {
return m.Size()
}
func (m *EventZRC20Deployed) XXX_DiscardUnknown() {
xxx_messageInfo_EventZRC20Deployed.DiscardUnknown(m)
}
var xxx_messageInfo_EventZRC20Deployed proto.InternalMessageInfo
func (m *EventZRC20Deployed) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventZRC20Deployed) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *EventZRC20Deployed) GetContract() string {
if m != nil {
return m.Contract
}
return ""
}
func (m *EventZRC20Deployed) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *EventZRC20Deployed) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
func (m *EventZRC20Deployed) GetDecimals() int64 {
if m != nil {
return m.Decimals
}
return 0
}
func (m *EventZRC20Deployed) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *EventZRC20Deployed) GetErc20() string {
if m != nil {
return m.Erc20
}
return ""
}
func (m *EventZRC20Deployed) GetGasLimit() int64 {
if m != nil {
return m.GasLimit
}
return 0
}
type EventZRC20WithdrawFeeUpdated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
CoinType common.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
Zrc20Address string `protobuf:"bytes,4,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"`
OldWithdrawFee string `protobuf:"bytes,5,opt,name=old_withdraw_fee,json=oldWithdrawFee,proto3" json:"old_withdraw_fee,omitempty"`
NewWithdrawFee string `protobuf:"bytes,6,opt,name=new_withdraw_fee,json=newWithdrawFee,proto3" json:"new_withdraw_fee,omitempty"`
Signer string `protobuf:"bytes,7,opt,name=signer,proto3" json:"signer,omitempty"`
OldGasLimit string `protobuf:"bytes,8,opt,name=old_gas_limit,json=oldGasLimit,proto3" json:"old_gas_limit,omitempty"`
NewGasLimit string `protobuf:"bytes,9,opt,name=new_gas_limit,json=newGasLimit,proto3" json:"new_gas_limit,omitempty"`
}
func (m *EventZRC20WithdrawFeeUpdated) Reset() { *m = EventZRC20WithdrawFeeUpdated{} }
func (m *EventZRC20WithdrawFeeUpdated) String() string { return proto.CompactTextString(m) }
func (*EventZRC20WithdrawFeeUpdated) ProtoMessage() {}
func (*EventZRC20WithdrawFeeUpdated) Descriptor() ([]byte, []int) {
return fileDescriptor_858e6494730deffd, []int{2}
}
func (m *EventZRC20WithdrawFeeUpdated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventZRC20WithdrawFeeUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventZRC20WithdrawFeeUpdated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventZRC20WithdrawFeeUpdated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventZRC20WithdrawFeeUpdated.Merge(m, src)
}
func (m *EventZRC20WithdrawFeeUpdated) XXX_Size() int {
return m.Size()
}
func (m *EventZRC20WithdrawFeeUpdated) XXX_DiscardUnknown() {
xxx_messageInfo_EventZRC20WithdrawFeeUpdated.DiscardUnknown(m)
}
var xxx_messageInfo_EventZRC20WithdrawFeeUpdated proto.InternalMessageInfo
func (m *EventZRC20WithdrawFeeUpdated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventZRC20WithdrawFeeUpdated) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *EventZRC20WithdrawFeeUpdated) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *EventZRC20WithdrawFeeUpdated) GetZrc20Address() string {
if m != nil {
return m.Zrc20Address
}
return ""
}
func (m *EventZRC20WithdrawFeeUpdated) GetOldWithdrawFee() string {
if m != nil {
return m.OldWithdrawFee
}
return ""
}
func (m *EventZRC20WithdrawFeeUpdated) GetNewWithdrawFee() string {
if m != nil {
return m.NewWithdrawFee
}
return ""
}
func (m *EventZRC20WithdrawFeeUpdated) GetSigner() string {
if m != nil {
return m.Signer
}
return ""
}
func (m *EventZRC20WithdrawFeeUpdated) GetOldGasLimit() string {
if m != nil {
return m.OldGasLimit
}
return ""
}
func (m *EventZRC20WithdrawFeeUpdated) GetNewGasLimit() string {
if m != nil {
return m.NewGasLimit
}
return ""
}
type EventZRC20PausedStatusUpdated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
Zrc20Addresses []string `protobuf:"bytes,2,rep,name=zrc20_addresses,json=zrc20Addresses,proto3" json:"zrc20_addresses,omitempty"`
Action UpdatePausedStatusAction `protobuf:"varint,3,opt,name=action,proto3,enum=zetachain.zetacore.fungible.UpdatePausedStatusAction" json:"action,omitempty"`
Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"`
}
func (m *EventZRC20PausedStatusUpdated) Reset() { *m = EventZRC20PausedStatusUpdated{} }
func (m *EventZRC20PausedStatusUpdated) String() string { return proto.CompactTextString(m) }
func (*EventZRC20PausedStatusUpdated) ProtoMessage() {}
func (*EventZRC20PausedStatusUpdated) Descriptor() ([]byte, []int) {
return fileDescriptor_858e6494730deffd, []int{3}
}
func (m *EventZRC20PausedStatusUpdated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventZRC20PausedStatusUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventZRC20PausedStatusUpdated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventZRC20PausedStatusUpdated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventZRC20PausedStatusUpdated.Merge(m, src)
}
func (m *EventZRC20PausedStatusUpdated) XXX_Size() int {
return m.Size()
}
func (m *EventZRC20PausedStatusUpdated) XXX_DiscardUnknown() {
xxx_messageInfo_EventZRC20PausedStatusUpdated.DiscardUnknown(m)
}
var xxx_messageInfo_EventZRC20PausedStatusUpdated proto.InternalMessageInfo
func (m *EventZRC20PausedStatusUpdated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventZRC20PausedStatusUpdated) GetZrc20Addresses() []string {
if m != nil {
return m.Zrc20Addresses
}
return nil
}
func (m *EventZRC20PausedStatusUpdated) GetAction() UpdatePausedStatusAction {
if m != nil {
return m.Action
}
return UpdatePausedStatusAction_PAUSE
}
func (m *EventZRC20PausedStatusUpdated) GetSigner() string {
if m != nil {
return m.Signer
}
return ""
}
func init() {
proto.RegisterType((*EventSystemContractUpdated)(nil), "zetachain.zetacore.fungible.EventSystemContractUpdated")
proto.RegisterType((*EventZRC20Deployed)(nil), "zetachain.zetacore.fungible.EventZRC20Deployed")
proto.RegisterType((*EventZRC20WithdrawFeeUpdated)(nil), "zetachain.zetacore.fungible.EventZRC20WithdrawFeeUpdated")
proto.RegisterType((*EventZRC20PausedStatusUpdated)(nil), "zetachain.zetacore.fungible.EventZRC20PausedStatusUpdated")
}
func init() { proto.RegisterFile("fungible/events.proto", fileDescriptor_858e6494730deffd) }
var fileDescriptor_858e6494730deffd = []byte{
// 593 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcb, 0x6e, 0xd3, 0x4c,
0x14, 0xae, 0x9b, 0x36, 0x6d, 0xa6, 0x97, 0xbf, 0xff, 0x50, 0x90, 0x49, 0xc1, 0xaa, 0xc2, 0x82,
0x6e, 0x6a, 0x57, 0x45, 0x3c, 0x40, 0x29, 0x17, 0x55, 0x02, 0x09, 0xa5, 0x54, 0x48, 0xdd, 0x58,
0x13, 0xcf, 0xa9, 0x3b, 0x92, 0x3d, 0x63, 0x79, 0x26, 0xb8, 0xee, 0x53, 0xb0, 0xe3, 0x5d, 0x78,
0x02, 0x96, 0x65, 0xc7, 0x12, 0x35, 0x2f, 0x82, 0xe6, 0xe2, 0x5c, 0x40, 0x94, 0xac, 0x72, 0xce,
0xe4, 0x3b, 0xe7, 0xfb, 0xfc, 0x9d, 0x33, 0x83, 0xee, 0x5f, 0x0c, 0x79, 0xca, 0x06, 0x19, 0x44,
0xf0, 0x09, 0xb8, 0x92, 0x61, 0x51, 0x0a, 0x25, 0xf0, 0xce, 0x35, 0x28, 0x92, 0x5c, 0x12, 0xc6,
0x43, 0x13, 0x89, 0x12, 0xc2, 0x06, 0xd9, 0xbd, 0x97, 0x88, 0x3c, 0x17, 0x3c, 0xb2, 0x3f, 0xb6,
0xa2, 0xfb, 0xff, 0xb8, 0x91, 0xba, 0x72, 0x47, 0xdb, 0xa9, 0x48, 0x85, 0x09, 0x23, 0x1d, 0xd9,
0xd3, 0xde, 0x57, 0x0f, 0x75, 0x5f, 0x69, 0xae, 0xd3, 0x5a, 0x2a, 0xc8, 0x8f, 0x05, 0x57, 0x25,
0x49, 0xd4, 0x59, 0x41, 0x89, 0x02, 0x8a, 0x77, 0xd1, 0x7a, 0x2e, 0xd3, 0x58, 0xd5, 0x05, 0xc4,
0xc3, 0x32, 0xf3, 0xbd, 0x5d, 0x6f, 0xaf, 0xd3, 0x47, 0xb9, 0x4c, 0x3f, 0xd4, 0x05, 0x9c, 0x95,
0x19, 0x3e, 0x40, 0xdb, 0x1c, 0xaa, 0x38, 0x71, 0x85, 0x31, 0xa1, 0xb4, 0x04, 0x29, 0xfd, 0x45,
0x83, 0xc4, 0x1c, 0xaa, 0xa6, 0xe7, 0x91, 0xfd, 0x47, 0x57, 0x88, 0x8c, 0xfe, 0x59, 0xd1, 0xb2,
0x15, 0x22, 0xa3, 0xbf, 0x57, 0x3c, 0x40, 0x6d, 0xc9, 0x52, 0x0e, 0xa5, 0xbf, 0x64, 0x30, 0x2e,
0xeb, 0x7d, 0x59, 0x44, 0xd8, 0x88, 0x3f, 0xef, 0x1f, 0x1f, 0x1e, 0xbc, 0x84, 0x22, 0x13, 0xf5,
0x5c, 0xa2, 0x1f, 0xa2, 0x55, 0x63, 0x67, 0xcc, 0xa8, 0x11, 0xda, 0xea, 0xaf, 0x98, 0xfc, 0x84,
0xe2, 0x2e, 0x5a, 0x6d, 0x94, 0x39, 0x45, 0xe3, 0x1c, 0x63, 0xb4, 0xc4, 0x49, 0x0e, 0x4e, 0x85,
0x89, 0x8d, 0xb6, 0x3a, 0x1f, 0x88, 0xcc, 0x5f, 0x76, 0xda, 0x4c, 0xa6, 0xfb, 0x50, 0x48, 0x58,
0x4e, 0x32, 0xe9, 0xb7, 0x0d, 0xc5, 0x38, 0xc7, 0xfb, 0xa8, 0x93, 0x08, 0xc6, 0x8d, 0x42, 0x7f,
0x65, 0xd7, 0xdb, 0xdb, 0x3c, 0xdc, 0x0a, 0xdd, 0xfc, 0x8e, 0x05, 0xe3, 0x5a, 0xa6, 0xa6, 0xb5,
0x11, 0xde, 0x46, 0xcb, 0x50, 0x26, 0x87, 0x07, 0xfe, 0xaa, 0x61, 0xb0, 0x09, 0xde, 0x41, 0x9d,
0x94, 0xc8, 0x38, 0x63, 0x39, 0x53, 0x7e, 0xc7, 0x32, 0xa4, 0x44, 0xbe, 0xd5, 0x79, 0x6f, 0xb4,
0x88, 0x1e, 0x4d, 0x9c, 0xf9, 0xc8, 0xd4, 0x25, 0x2d, 0x49, 0xf5, 0x1a, 0x60, 0xfe, 0xc1, 0xde,
0xe1, 0xd1, 0x8c, 0xfe, 0xd6, 0x3f, 0xf5, 0x3f, 0x41, 0x1b, 0xd7, 0x5a, 0xf2, 0x78, 0xd2, 0xd6,
0xbf, 0x75, 0x73, 0xd8, 0xcc, 0x78, 0x0f, 0x6d, 0xe9, 0xad, 0xa8, 0x9c, 0xd4, 0xf8, 0x02, 0xc0,
0x39, 0xba, 0x29, 0x32, 0x3a, 0xf5, 0x05, 0x1a, 0xa9, 0x37, 0x6e, 0x06, 0xd9, 0xb6, 0x48, 0x0e,
0xd5, 0x34, 0x72, 0xb2, 0x37, 0x2b, 0xd3, 0x7b, 0x83, 0x7b, 0x68, 0x43, 0x73, 0x4d, 0xec, 0xb3,
0xc6, 0xae, 0x89, 0x8c, 0xbe, 0x71, 0x0e, 0x6a, 0x8c, 0x66, 0x99, 0xb5, 0xb8, 0xd3, 0x5f, 0xe3,
0x50, 0x35, 0x98, 0xde, 0x77, 0x0f, 0x3d, 0x9e, 0xb8, 0xfc, 0x9e, 0x0c, 0x25, 0xd0, 0x53, 0x45,
0xd4, 0x50, 0xce, 0x6f, 0xf3, 0x53, 0xf4, 0xdf, 0x8c, 0x39, 0xa0, 0xaf, 0x4e, 0x4b, 0x7f, 0xcc,
0xb4, 0x3d, 0x20, 0xf1, 0x3b, 0xd4, 0x26, 0x89, 0x62, 0x82, 0x3b, 0xc7, 0x9f, 0x87, 0x77, 0xbc,
0x0a, 0xa1, 0x15, 0x30, 0x2d, 0xe9, 0xc8, 0x14, 0xf7, 0x5d, 0x93, 0xbf, 0xdd, 0xa9, 0x17, 0x27,
0xdf, 0x6e, 0x03, 0xef, 0xe6, 0x36, 0xf0, 0x7e, 0xde, 0x06, 0xde, 0xe7, 0x51, 0xb0, 0x70, 0x33,
0x0a, 0x16, 0x7e, 0x8c, 0x82, 0x85, 0xf3, 0x28, 0x65, 0xea, 0x72, 0x38, 0xd0, 0x83, 0x8e, 0x34,
0xe1, 0xbe, 0xe1, 0x8e, 0x1a, 0xee, 0xe8, 0x2a, 0x9a, 0x3c, 0x3a, 0x75, 0x01, 0x72, 0xd0, 0x36,
0x4f, 0xcc, 0xb3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x60, 0xaf, 0x2f, 0xd6, 0x04, 0x00,
0x00,
}
func (m *EventSystemContractUpdated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventSystemContractUpdated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventSystemContractUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Signer) > 0 {
i -= len(m.Signer)
copy(dAtA[i:], m.Signer)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer)))
i--
dAtA[i] = 0x22
}
if len(m.OldContractAddress) > 0 {
i -= len(m.OldContractAddress)
copy(dAtA[i:], m.OldContractAddress)
i = encodeVarintEvents(dAtA, i, uint64(len(m.OldContractAddress)))
i--
dAtA[i] = 0x1a
}
if len(m.NewContractAddress) > 0 {
i -= len(m.NewContractAddress)
copy(dAtA[i:], m.NewContractAddress)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewContractAddress)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventZRC20Deployed) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventZRC20Deployed) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventZRC20Deployed) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.GasLimit != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.GasLimit))
i--
dAtA[i] = 0x48
}
if len(m.Erc20) > 0 {
i -= len(m.Erc20)
copy(dAtA[i:], m.Erc20)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Erc20)))
i--
dAtA[i] = 0x42
}
if m.CoinType != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x38
}
if m.Decimals != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.Decimals))
i--
dAtA[i] = 0x30
}
if len(m.Symbol) > 0 {
i -= len(m.Symbol)
copy(dAtA[i:], m.Symbol)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Symbol)))
i--
dAtA[i] = 0x2a
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x22
}
if len(m.Contract) > 0 {
i -= len(m.Contract)
copy(dAtA[i:], m.Contract)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Contract)))
i--
dAtA[i] = 0x1a
}
if m.ChainId != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventZRC20WithdrawFeeUpdated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventZRC20WithdrawFeeUpdated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventZRC20WithdrawFeeUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NewGasLimit) > 0 {
i -= len(m.NewGasLimit)
copy(dAtA[i:], m.NewGasLimit)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewGasLimit)))
i--
dAtA[i] = 0x4a
}
if len(m.OldGasLimit) > 0 {
i -= len(m.OldGasLimit)
copy(dAtA[i:], m.OldGasLimit)
i = encodeVarintEvents(dAtA, i, uint64(len(m.OldGasLimit)))
i--
dAtA[i] = 0x42
}
if len(m.Signer) > 0 {
i -= len(m.Signer)
copy(dAtA[i:], m.Signer)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer)))
i--
dAtA[i] = 0x3a
}
if len(m.NewWithdrawFee) > 0 {
i -= len(m.NewWithdrawFee)
copy(dAtA[i:], m.NewWithdrawFee)
i = encodeVarintEvents(dAtA, i, uint64(len(m.NewWithdrawFee)))
i--
dAtA[i] = 0x32
}
if len(m.OldWithdrawFee) > 0 {
i -= len(m.OldWithdrawFee)
copy(dAtA[i:], m.OldWithdrawFee)
i = encodeVarintEvents(dAtA, i, uint64(len(m.OldWithdrawFee)))
i--
dAtA[i] = 0x2a
}
if len(m.Zrc20Address) > 0 {
i -= len(m.Zrc20Address)
copy(dAtA[i:], m.Zrc20Address)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Zrc20Address)))
i--
dAtA[i] = 0x22
}
if m.CoinType != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x18
}
if m.ChainId != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventZRC20PausedStatusUpdated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventZRC20PausedStatusUpdated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventZRC20PausedStatusUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Signer) > 0 {
i -= len(m.Signer)
copy(dAtA[i:], m.Signer)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer)))
i--
dAtA[i] = 0x22
}
if m.Action != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.Action))
i--
dAtA[i] = 0x18
}
if len(m.Zrc20Addresses) > 0 {
for iNdEx := len(m.Zrc20Addresses) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Zrc20Addresses[iNdEx])
copy(dAtA[i:], m.Zrc20Addresses[iNdEx])
i = encodeVarintEvents(dAtA, i, uint64(len(m.Zrc20Addresses[iNdEx])))
i--
dAtA[i] = 0x12
}
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
offset -= sovEvents(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *EventSystemContractUpdated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewContractAddress)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.OldContractAddress)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventZRC20Deployed) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovEvents(uint64(m.ChainId))
}
l = len(m.Contract)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Name)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Symbol)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.Decimals != 0 {
n += 1 + sovEvents(uint64(m.Decimals))
}
if m.CoinType != 0 {
n += 1 + sovEvents(uint64(m.CoinType))
}
l = len(m.Erc20)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.GasLimit != 0 {
n += 1 + sovEvents(uint64(m.GasLimit))
}
return n
}
func (m *EventZRC20WithdrawFeeUpdated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovEvents(uint64(m.ChainId))
}
if m.CoinType != 0 {
n += 1 + sovEvents(uint64(m.CoinType))
}
l = len(m.Zrc20Address)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.OldWithdrawFee)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewWithdrawFee)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.OldGasLimit)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.NewGasLimit)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventZRC20PausedStatusUpdated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if len(m.Zrc20Addresses) > 0 {
for _, s := range m.Zrc20Addresses {
l = len(s)
n += 1 + l + sovEvents(uint64(l))
}
}
if m.Action != 0 {
n += 1 + sovEvents(uint64(m.Action))
}
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func sovEvents(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozEvents(x uint64) (n int) {
return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *EventSystemContractUpdated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventSystemContractUpdated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventSystemContractUpdated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OldContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OldContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventZRC20Deployed) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventZRC20Deployed: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventZRC20Deployed: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Contract = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Symbol = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType)
}
m.Decimals = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Decimals |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Erc20", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Erc20 = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
m.GasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasLimit |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventZRC20WithdrawFeeUpdated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventZRC20WithdrawFeeUpdated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventZRC20WithdrawFeeUpdated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Zrc20Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OldWithdrawFee", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OldWithdrawFee = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewWithdrawFee", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewWithdrawFee = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OldGasLimit", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OldGasLimit = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewGasLimit", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewGasLimit = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventZRC20PausedStatusUpdated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventZRC20PausedStatusUpdated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventZRC20PausedStatusUpdated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Addresses", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Zrc20Addresses = append(m.Zrc20Addresses, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType)
}
m.Action = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Action |= UpdatePausedStatusAction(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEvents(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthEvents
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEvents
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: fungible/foreign_coins.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ForeignCoins struct {
// string index = 1;
Zrc20ContractAddress string `protobuf:"bytes,2,opt,name=zrc20_contract_address,json=zrc20ContractAddress,proto3" json:"zrc20_contract_address,omitempty"`
Asset string `protobuf:"bytes,3,opt,name=asset,proto3" json:"asset,omitempty"`
ForeignChainId int64 `protobuf:"varint,4,opt,name=foreign_chain_id,json=foreignChainId,proto3" json:"foreign_chain_id,omitempty"`
Decimals uint32 `protobuf:"varint,5,opt,name=decimals,proto3" json:"decimals,omitempty"`
Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
Symbol string `protobuf:"bytes,7,opt,name=symbol,proto3" json:"symbol,omitempty"`
CoinType common.CoinType `protobuf:"varint,8,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
GasLimit uint64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
Paused bool `protobuf:"varint,10,opt,name=paused,proto3" json:"paused,omitempty"`
LiquidityCap github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,11,opt,name=liquidity_cap,json=liquidityCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"liquidity_cap"`
}
func (m *ForeignCoins) Reset() { *m = ForeignCoins{} }
func (m *ForeignCoins) String() string { return proto.CompactTextString(m) }
func (*ForeignCoins) ProtoMessage() {}
func (*ForeignCoins) Descriptor() ([]byte, []int) {
return fileDescriptor_5285bb476cecbbf8, []int{0}
}
func (m *ForeignCoins) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ForeignCoins) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ForeignCoins.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ForeignCoins) XXX_Merge(src proto.Message) {
xxx_messageInfo_ForeignCoins.Merge(m, src)
}
func (m *ForeignCoins) XXX_Size() int {
return m.Size()
}
func (m *ForeignCoins) XXX_DiscardUnknown() {
xxx_messageInfo_ForeignCoins.DiscardUnknown(m)
}
var xxx_messageInfo_ForeignCoins proto.InternalMessageInfo
func (m *ForeignCoins) GetZrc20ContractAddress() string {
if m != nil {
return m.Zrc20ContractAddress
}
return ""
}
func (m *ForeignCoins) GetAsset() string {
if m != nil {
return m.Asset
}
return ""
}
func (m *ForeignCoins) GetForeignChainId() int64 {
if m != nil {
return m.ForeignChainId
}
return 0
}
func (m *ForeignCoins) GetDecimals() uint32 {
if m != nil {
return m.Decimals
}
return 0
}
func (m *ForeignCoins) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *ForeignCoins) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
func (m *ForeignCoins) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *ForeignCoins) GetGasLimit() uint64 {
if m != nil {
return m.GasLimit
}
return 0
}
func (m *ForeignCoins) GetPaused() bool {
if m != nil {
return m.Paused
}
return false
}
func init() {
proto.RegisterType((*ForeignCoins)(nil), "zetachain.zetacore.fungible.ForeignCoins")
}
func init() { proto.RegisterFile("fungible/foreign_coins.proto", fileDescriptor_5285bb476cecbbf8) }
var fileDescriptor_5285bb476cecbbf8 = []byte{
// 416 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x52, 0xc1, 0x6e, 0xd4, 0x30,
0x14, 0x5c, 0xb3, 0xdb, 0x25, 0x6b, 0xda, 0xaa, 0x32, 0xab, 0xca, 0xda, 0xa2, 0x34, 0xe2, 0x42,
0x2e, 0x1b, 0xa3, 0xc2, 0x0f, 0xd0, 0x48, 0x48, 0x95, 0x38, 0x45, 0xe5, 0xc2, 0x25, 0x72, 0x6c,
0x37, 0xb5, 0x48, 0xec, 0x10, 0x3b, 0x12, 0xe9, 0x07, 0x70, 0xe6, 0xb3, 0x7a, 0xec, 0x11, 0x71,
0xa8, 0xd0, 0xee, 0x8f, 0x20, 0x3b, 0x69, 0xd4, 0x93, 0x67, 0xe6, 0xc5, 0xf3, 0x26, 0xef, 0x19,
0xbe, 0xb9, 0xe9, 0x54, 0x29, 0x8b, 0x4a, 0x90, 0x1b, 0xdd, 0x0a, 0x59, 0xaa, 0x9c, 0x69, 0xa9,
0x4c, 0xd2, 0xb4, 0xda, 0x6a, 0x74, 0x76, 0x27, 0x2c, 0x65, 0xb7, 0x54, 0xaa, 0xc4, 0x23, 0xdd,
0x8a, 0xe4, 0xe9, 0xc2, 0xe6, 0x35, 0xd3, 0x75, 0xad, 0x15, 0x19, 0x8e, 0xe1, 0xc6, 0x66, 0x5d,
0xea, 0x52, 0x7b, 0x48, 0x1c, 0x1a, 0xd4, 0xb7, 0xbf, 0xe6, 0xf0, 0xf0, 0xf3, 0xe0, 0x9f, 0x3a,
0x7b, 0xf4, 0x11, 0x9e, 0xde, 0xb5, 0xec, 0xe2, 0x7d, 0xce, 0xb4, 0xb2, 0x2d, 0x65, 0x36, 0xa7,
0x9c, 0xb7, 0xc2, 0x18, 0xfc, 0x22, 0x02, 0xf1, 0x2a, 0x5b, 0xfb, 0x6a, 0x3a, 0x16, 0x3f, 0x0d,
0x35, 0xb4, 0x86, 0x07, 0xd4, 0x18, 0x61, 0xf1, 0xdc, 0x7f, 0x34, 0x10, 0x14, 0xc3, 0x93, 0x29,
0xbb, 0x8b, 0x9a, 0x4b, 0x8e, 0x17, 0x11, 0x88, 0xe7, 0xd9, 0xf1, 0xa8, 0xa7, 0x4e, 0xbe, 0xe2,
0x68, 0x03, 0x03, 0x2e, 0x98, 0xac, 0x69, 0x65, 0xf0, 0x41, 0x04, 0xe2, 0xa3, 0x6c, 0xe2, 0x08,
0xc1, 0x85, 0xa2, 0xb5, 0xc0, 0x4b, 0x6f, 0xed, 0x31, 0x3a, 0x85, 0x4b, 0xd3, 0xd7, 0x85, 0xae,
0xf0, 0x4b, 0xaf, 0x8e, 0x0c, 0x6d, 0xe1, 0xca, 0x4d, 0x29, 0xb7, 0x7d, 0x23, 0x70, 0x10, 0x81,
0xf8, 0xf8, 0xe2, 0x24, 0x19, 0xc7, 0xe0, 0xfe, 0xef, 0xba, 0x6f, 0x44, 0x16, 0xb0, 0x11, 0xa1,
0x33, 0xb8, 0x2a, 0xa9, 0xc9, 0x2b, 0x59, 0x4b, 0x8b, 0x57, 0x11, 0x88, 0x17, 0x59, 0x50, 0x52,
0xf3, 0xc5, 0x71, 0xd7, 0xa3, 0xa1, 0x9d, 0x11, 0x1c, 0xc3, 0x08, 0xc4, 0x41, 0x36, 0x32, 0x74,
0x0d, 0x8f, 0x2a, 0xf9, 0xa3, 0x93, 0x5c, 0xda, 0x3e, 0x67, 0xb4, 0xc1, 0xaf, 0x5c, 0x84, 0x4b,
0x72, 0xff, 0x78, 0x3e, 0xfb, 0xfb, 0x78, 0xfe, 0xae, 0x94, 0xf6, 0xb6, 0x2b, 0x5c, 0x57, 0xc2,
0xb4, 0xa9, 0xb5, 0x19, 0x8f, 0xad, 0xe1, 0xdf, 0x89, 0x0b, 0x66, 0x92, 0xaf, 0x52, 0xd9, 0xec,
0x70, 0x72, 0x49, 0x69, 0x73, 0x79, 0x75, 0xbf, 0x0b, 0xc1, 0xc3, 0x2e, 0x04, 0xff, 0x76, 0x21,
0xf8, 0xbd, 0x0f, 0x67, 0x0f, 0xfb, 0x70, 0xf6, 0x67, 0x1f, 0xce, 0xbe, 0x91, 0x67, 0x86, 0x6e,
0xd7, 0x5b, 0x3f, 0x4b, 0xf2, 0xb4, 0x76, 0xf2, 0x93, 0x4c, 0x2f, 0xc5, 0xbb, 0x17, 0x4b, 0xbf,
0xda, 0x0f, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xf5, 0xe7, 0x49, 0x42, 0x02, 0x00, 0x00,
}
func (m *ForeignCoins) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ForeignCoins) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ForeignCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.LiquidityCap.Size()
i -= size
if _, err := m.LiquidityCap.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintForeignCoins(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x5a
if m.Paused {
i--
if m.Paused {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x50
}
if m.GasLimit != 0 {
i = encodeVarintForeignCoins(dAtA, i, uint64(m.GasLimit))
i--
dAtA[i] = 0x48
}
if m.CoinType != 0 {
i = encodeVarintForeignCoins(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x40
}
if len(m.Symbol) > 0 {
i -= len(m.Symbol)
copy(dAtA[i:], m.Symbol)
i = encodeVarintForeignCoins(dAtA, i, uint64(len(m.Symbol)))
i--
dAtA[i] = 0x3a
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintForeignCoins(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x32
}
if m.Decimals != 0 {
i = encodeVarintForeignCoins(dAtA, i, uint64(m.Decimals))
i--
dAtA[i] = 0x28
}
if m.ForeignChainId != 0 {
i = encodeVarintForeignCoins(dAtA, i, uint64(m.ForeignChainId))
i--
dAtA[i] = 0x20
}
if len(m.Asset) > 0 {
i -= len(m.Asset)
copy(dAtA[i:], m.Asset)
i = encodeVarintForeignCoins(dAtA, i, uint64(len(m.Asset)))
i--
dAtA[i] = 0x1a
}
if len(m.Zrc20ContractAddress) > 0 {
i -= len(m.Zrc20ContractAddress)
copy(dAtA[i:], m.Zrc20ContractAddress)
i = encodeVarintForeignCoins(dAtA, i, uint64(len(m.Zrc20ContractAddress)))
i--
dAtA[i] = 0x12
}
return len(dAtA) - i, nil
}
func encodeVarintForeignCoins(dAtA []byte, offset int, v uint64) int {
offset -= sovForeignCoins(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *ForeignCoins) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Zrc20ContractAddress)
if l > 0 {
n += 1 + l + sovForeignCoins(uint64(l))
}
l = len(m.Asset)
if l > 0 {
n += 1 + l + sovForeignCoins(uint64(l))
}
if m.ForeignChainId != 0 {
n += 1 + sovForeignCoins(uint64(m.ForeignChainId))
}
if m.Decimals != 0 {
n += 1 + sovForeignCoins(uint64(m.Decimals))
}
l = len(m.Name)
if l > 0 {
n += 1 + l + sovForeignCoins(uint64(l))
}
l = len(m.Symbol)
if l > 0 {
n += 1 + l + sovForeignCoins(uint64(l))
}
if m.CoinType != 0 {
n += 1 + sovForeignCoins(uint64(m.CoinType))
}
if m.GasLimit != 0 {
n += 1 + sovForeignCoins(uint64(m.GasLimit))
}
if m.Paused {
n += 2
}
l = m.LiquidityCap.Size()
n += 1 + l + sovForeignCoins(uint64(l))
return n
}
func sovForeignCoins(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozForeignCoins(x uint64) (n int) {
return sovForeignCoins(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *ForeignCoins) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ForeignCoins: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ForeignCoins: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zrc20ContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthForeignCoins
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthForeignCoins
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Zrc20ContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthForeignCoins
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthForeignCoins
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Asset = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ForeignChainId", wireType)
}
m.ForeignChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ForeignChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType)
}
m.Decimals = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Decimals |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthForeignCoins
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthForeignCoins
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthForeignCoins
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthForeignCoins
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Symbol = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
m.GasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasLimit |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 10:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Paused", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Paused = bool(v != 0)
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LiquidityCap", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthForeignCoins
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthForeignCoins
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.LiquidityCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipForeignCoins(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthForeignCoins
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipForeignCoins(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowForeignCoins
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthForeignCoins
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupForeignCoins
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthForeignCoins
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthForeignCoins = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowForeignCoins = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupForeignCoins = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
"crypto/sha256"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
)
// GasStabilityPoolAddress returns the address of the gas stability pool
func GasStabilityPoolAddress() sdk.AccAddress {
hash := sha256.Sum256([]byte("gas_stability_pool"))
return hash[:20]
}
// GasStabilityPoolAddressEVM returns the address of the gas stability pool in EVM format
func GasStabilityPoolAddressEVM() ethcommon.Address {
return ethcommon.BytesToAddress(GasStabilityPoolAddress())
}
package types
import (
"fmt"
)
// DefaultGenesis returns the default fungible genesis state
func DefaultGenesis() *GenesisState {
return &GenesisState{
ForeignCoinsList: []ForeignCoins{},
SystemContract: nil,
Params: DefaultParams(),
}
}
// Validate performs basic genesis state validation returning an error upon any
// failure.
func (gs GenesisState) Validate() error {
// Check for duplicated index in foreignCoins
foreignCoinsIndexMap := make(map[string]struct{})
for _, elem := range gs.ForeignCoinsList {
index := string(ForeignCoinsKey(elem.Zrc20ContractAddress))
if _, ok := foreignCoinsIndexMap[index]; ok {
return fmt.Errorf("duplicated index for foreignCoins")
}
foreignCoinsIndexMap[index] = struct{}{}
}
return gs.Params.Validate()
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: fungible/genesis.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the fungible module's genesis state.
type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
ForeignCoinsList []ForeignCoins `protobuf:"bytes,2,rep,name=foreignCoinsList,proto3" json:"foreignCoinsList"`
SystemContract *SystemContract `protobuf:"bytes,3,opt,name=systemContract,proto3" json:"systemContract,omitempty"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_11e46382f3a6d0c2, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
func (m *GenesisState) GetForeignCoinsList() []ForeignCoins {
if m != nil {
return m.ForeignCoinsList
}
return nil
}
func (m *GenesisState) GetSystemContract() *SystemContract {
if m != nil {
return m.SystemContract
}
return nil
}
func init() {
proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.fungible.GenesisState")
}
func init() { proto.RegisterFile("fungible/genesis.proto", fileDescriptor_11e46382f3a6d0c2) }
var fileDescriptor_11e46382f3a6d0c2 = []byte{
// 291 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0x2b, 0xcd, 0x4b,
0xcf, 0x4c, 0xca, 0x49, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca,
0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3,
0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x4a, 0xa5, 0x64, 0xe0, 0x9a, 0xd2, 0xf2, 0x8b, 0x52, 0x33, 0xd3,
0xf3, 0xe2, 0x93, 0xf3, 0x33, 0xf3, 0xa0, 0x5a, 0xa5, 0x44, 0xe1, 0xb2, 0x05, 0x89, 0x45, 0x89,
0xb9, 0x30, 0x61, 0x39, 0xb8, 0x70, 0x71, 0x65, 0x71, 0x49, 0x6a, 0x6e, 0x7c, 0x72, 0x7e, 0x5e,
0x49, 0x51, 0x62, 0x72, 0x09, 0x54, 0x5e, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, 0xb1,
0x20, 0xa2, 0x4a, 0xcd, 0x4c, 0x5c, 0x3c, 0xee, 0x10, 0x97, 0x05, 0x97, 0x24, 0x96, 0xa4, 0x0a,
0x39, 0x72, 0xb1, 0x41, 0x8c, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x52, 0xd6, 0xc3, 0xe3,
0x52, 0xbd, 0x00, 0xb0, 0x52, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0x1a, 0x85, 0xa2,
0xb9, 0x04, 0xa0, 0xee, 0x76, 0x06, 0x39, 0xdb, 0x27, 0xb3, 0xb8, 0x44, 0x82, 0x49, 0x81, 0x59,
0x83, 0xdb, 0x48, 0x13, 0xaf, 0x61, 0x6e, 0x48, 0x9a, 0xa0, 0x46, 0x62, 0x18, 0x24, 0x14, 0xcc,
0xc5, 0x07, 0xf1, 0x9f, 0x33, 0xd4, 0x7b, 0x12, 0xcc, 0x60, 0x77, 0x6a, 0xe3, 0x35, 0x3a, 0x18,
0x45, 0x4b, 0x10, 0x9a, 0x11, 0x4e, 0x9e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8,
0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7,
0x10, 0xa5, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x32, 0x56,
0x17, 0x6c, 0x83, 0x3e, 0xcc, 0x06, 0xfd, 0x0a, 0x7d, 0x78, 0xb0, 0x97, 0x54, 0x16, 0xa4, 0x16,
0x27, 0xb1, 0x81, 0xc3, 0xd5, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xf8, 0xb7, 0xd4, 0xf9,
0x01, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.SystemContract != nil {
{
size, err := m.SystemContract.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if len(m.ForeignCoinsList) > 0 {
for iNdEx := len(m.ForeignCoinsList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.ForeignCoinsList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
if len(m.ForeignCoinsList) > 0 {
for _, e := range m.ForeignCoinsList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if m.SystemContract != nil {
l = m.SystemContract.Size()
n += 1 + l + sovGenesis(uint64(l))
}
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ForeignCoinsList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ForeignCoinsList = append(m.ForeignCoinsList, ForeignCoins{})
if err := m.ForeignCoinsList[len(m.ForeignCoinsList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SystemContract", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.SystemContract == nil {
m.SystemContract = &SystemContract{}
}
if err := m.SystemContract.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
package types
const (
// ForeignCoinsKeyPrefix is the prefix to retrieve all ForeignCoins
ForeignCoinsKeyPrefix = "ForeignCoins/value/"
)
// ForeignCoinsKey returns the store key to retrieve a ForeignCoins from the index fields
func ForeignCoinsKey(
index string,
) []byte {
var key []byte
indexBytes := []byte(index)
key = append(key, indexBytes...)
key = append(key, []byte("/")...)
return key
}
package types
import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/ethereum/go-ethereum/common"
)
const (
// ModuleName defines the module name
ModuleName = "fungible"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey is the message route for slashing
RouterKey = ModuleName
// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_fungible"
)
func KeyPrefix(p string) []byte {
return []byte(p)
}
var (
ModuleAddress = authtypes.NewModuleAddress(ModuleName)
//ModuleAddressEVM common.EVMAddress
ModuleAddressEVM = common.BytesToAddress(ModuleAddress.Bytes())
AdminAddress = "zeta1rx9r8hff0adaqhr5tuadkzj4e7ns2ntg446vtt"
)
func init() {
//fmt.Printf("ModuleAddressEVM of %s: %s\n", ModuleName, ModuleAddressEVM.String())
// 0x735b14BB79463307AAcBED86DAf3322B1e6226aB
}
const (
SystemContractKey = "SystemContract-value-"
)
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
const TypeMsgDeployFungibleCoinZRC20 = "deploy_fungible_coin_zrc_20"
var _ sdk.Msg = &MsgDeployFungibleCoinZRC20{}
func NewMsgDeployFungibleCoinZRC20(creator string, ERC20 string, foreignChainID int64, decimals uint32, name string, symbol string, coinType common.CoinType, gasLimit int64) *MsgDeployFungibleCoinZRC20 {
return &MsgDeployFungibleCoinZRC20{
Creator: creator,
ERC20: ERC20,
ForeignChainId: foreignChainID,
Decimals: decimals,
Name: name,
Symbol: symbol,
CoinType: coinType,
GasLimit: gasLimit,
}
}
func (msg *MsgDeployFungibleCoinZRC20) Route() string {
return RouterKey
}
func (msg *MsgDeployFungibleCoinZRC20) Type() string {
return TypeMsgDeployFungibleCoinZRC20
}
func (msg *MsgDeployFungibleCoinZRC20) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgDeployFungibleCoinZRC20) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgDeployFungibleCoinZRC20) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.GasLimit < 0 {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidGasLimit, "invalid gas limit")
}
if msg.Decimals > 77 {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "decimals must be less than 78")
}
return nil
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgRemoveForeignCoin = "remove_foreign_coin"
var _ sdk.Msg = &MsgRemoveForeignCoin{}
func NewMsgRemoveForeignCoin(creator string, name string) *MsgRemoveForeignCoin {
return &MsgRemoveForeignCoin{
Creator: creator,
Name: name,
}
}
func (msg *MsgRemoveForeignCoin) Route() string {
return RouterKey
}
func (msg *MsgRemoveForeignCoin) Type() string {
return TypeMsgRemoveForeignCoin
}
func (msg *MsgRemoveForeignCoin) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgRemoveForeignCoin) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgRemoveForeignCoin) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}
package types
import (
cosmoserror "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
)
const TypeMsgUpdateContractBytecode = "update_contract_bytecode"
var _ sdk.Msg = &MsgUpdateContractBytecode{}
func NewMsgUpdateContractBytecode(
creator string, contractAddress ethcommon.Address, newBytecodeAddress ethcommon.Address,
) *MsgUpdateContractBytecode {
return &MsgUpdateContractBytecode{
Creator: creator,
ContractAddress: contractAddress.Hex(),
NewBytecodeAddress: newBytecodeAddress.Hex(),
}
}
func (msg *MsgUpdateContractBytecode) Route() string {
return RouterKey
}
func (msg *MsgUpdateContractBytecode) Type() string {
return TypeMsgUpdateContractBytecode
}
func (msg *MsgUpdateContractBytecode) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateContractBytecode) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateContractBytecode) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil {
return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
// check if the contract address is valid
if !ethcommon.IsHexAddress(msg.ContractAddress) {
return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress)
}
// check if the bytecode contract address is valid
if !ethcommon.IsHexAddress(msg.NewBytecodeAddress) {
return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress)
}
return nil
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
)
const TypeMsgUpdateSystemContract = "update_system_contract"
var _ sdk.Msg = &MsgUpdateSystemContract{}
func NewMsgUpdateSystemContract(creator string, systemContractAddr string) *MsgUpdateSystemContract {
return &MsgUpdateSystemContract{
Creator: creator,
NewSystemContractAddress: systemContractAddr,
}
}
func (msg *MsgUpdateSystemContract) Route() string {
return RouterKey
}
func (msg *MsgUpdateSystemContract) Type() string {
return TypeMsgUpdateSystemContract
}
func (msg *MsgUpdateSystemContract) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateSystemContract) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateSystemContract) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
// check if the system contract address is valid
if ethcommon.HexToAddress(msg.NewSystemContractAddress) == (ethcommon.Address{}) {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress)
}
return nil
}
package types
import (
cosmoserrors "cosmossdk.io/errors"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
)
const TypeMsgUpdateZRC20LiquidityCap = "update_zrc20_liquidity_cap"
var _ sdk.Msg = &MsgUpdateZRC20LiquidityCap{}
func NewMsgUpdateZRC20LiquidityCap(creator string, zrc20 string, liquidityCap math.Uint) *MsgUpdateZRC20LiquidityCap {
return &MsgUpdateZRC20LiquidityCap{
Creator: creator,
Zrc20Address: zrc20,
LiquidityCap: liquidityCap,
}
}
func (msg *MsgUpdateZRC20LiquidityCap) Route() string {
return RouterKey
}
func (msg *MsgUpdateZRC20LiquidityCap) Type() string {
return TypeMsgUpdateSystemContract
}
func (msg *MsgUpdateZRC20LiquidityCap) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateZRC20LiquidityCap) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateZRC20LiquidityCap) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if !ethcommon.IsHexAddress(msg.Zrc20Address) {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.Zrc20Address)
}
return nil
}
package types
import (
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
)
const TypeMsgUpdateZRC20PausedStatus = "update_zrc20_withdraw_fee"
var _ sdk.Msg = &MsgUpdateZRC20PausedStatus{}
func NewMsgUpdateZRC20PausedStatus(creator string, zrc20 []string, action UpdatePausedStatusAction) *MsgUpdateZRC20PausedStatus {
return &MsgUpdateZRC20PausedStatus{
Creator: creator,
Zrc20Addresses: zrc20,
Action: action,
}
}
func (msg *MsgUpdateZRC20PausedStatus) Route() string {
return RouterKey
}
func (msg *MsgUpdateZRC20PausedStatus) Type() string {
return TypeMsgUpdateZRC20PausedStatus
}
func (msg *MsgUpdateZRC20PausedStatus) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateZRC20PausedStatus) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateZRC20PausedStatus) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.Action != UpdatePausedStatusAction_PAUSE && msg.Action != UpdatePausedStatusAction_UNPAUSE {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid action (%d)", msg.Action)
}
if len(msg.Zrc20Addresses) == 0 {
return cosmoserrors.Wrap(sdkerrors.ErrInvalidRequest, "no zrc20 to update")
}
// check if all zrc20 addresses are valid
for _, zrc20 := range msg.Zrc20Addresses {
if !ethcommon.IsHexAddress(zrc20) {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", zrc20)
}
}
return nil
}
package types
import (
cosmoserror "cosmossdk.io/errors"
math "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
)
const TypeMsgUpdateZRC20WithdrawFee = "update_zrc20_withdraw_fee"
var _ sdk.Msg = &MsgUpdateZRC20WithdrawFee{}
func NewMsgUpdateZRC20WithdrawFee(creator string, zrc20 string, newFee math.Uint, newGasLimit math.Uint) *MsgUpdateZRC20WithdrawFee {
return &MsgUpdateZRC20WithdrawFee{
Creator: creator,
Zrc20Address: zrc20,
NewWithdrawFee: newFee,
NewGasLimit: newGasLimit,
}
}
func (msg *MsgUpdateZRC20WithdrawFee) Route() string {
return RouterKey
}
func (msg *MsgUpdateZRC20WithdrawFee) Type() string {
return TypeMsgUpdateZRC20WithdrawFee
}
func (msg *MsgUpdateZRC20WithdrawFee) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateZRC20WithdrawFee) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateZRC20WithdrawFee) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
// check if the system contract address is valid
if !ethcommon.IsHexAddress(msg.Zrc20Address) {
return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.Zrc20Address)
}
if msg.NewWithdrawFee.IsNil() && msg.NewGasLimit.IsNil() {
return cosmoserror.Wrapf(sdkerrors.ErrInvalidRequest, "nothing to update")
}
return nil
}
package types
import (
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"gopkg.in/yaml.v2"
)
var _ paramtypes.ParamSet = (*Params)(nil)
// ParamKeyTable the param key table for launch module
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}
// NewParams creates a new Params instance
func NewParams() Params {
return Params{}
}
// DefaultParams returns a default set of parameters
func DefaultParams() Params {
return NewParams()
}
// ParamSetPairs get the params.ParamSet
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{}
}
// Validate validates the set of params
func (p Params) Validate() error {
return nil
}
// String implements the Stringer interface.
func (p Params) String() string {
out, err := yaml.Marshal(p)
if err != nil {
return ""
}
return string(out)
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: fungible/params.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the parameters for the module.
type Params struct {
}
func (m *Params) Reset() { *m = Params{} }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_8285013990d8e1cf, []int{0}
}
func (m *Params) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Params) XXX_Merge(src proto.Message) {
xxx_messageInfo_Params.Merge(m, src)
}
func (m *Params) XXX_Size() int {
return m.Size()
}
func (m *Params) XXX_DiscardUnknown() {
xxx_messageInfo_Params.DiscardUnknown(m)
}
var xxx_messageInfo_Params proto.InternalMessageInfo
func init() {
proto.RegisterType((*Params)(nil), "zetachain.zetacore.fungible.Params")
}
func init() { proto.RegisterFile("fungible/params.proto", fileDescriptor_8285013990d8e1cf) }
var fileDescriptor_8285013990d8e1cf = []byte{
// 157 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x2b, 0xcd, 0x4b,
0xcf, 0x4c, 0xca, 0x49, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f,
0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2,
0x8b, 0x52, 0xf5, 0x60, 0x2a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, 0x2c,
0x88, 0x16, 0x25, 0x3e, 0x2e, 0xb6, 0x00, 0xb0, 0x11, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38,
0x79, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e,
0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x7e, 0x7a, 0x66, 0x49,
0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x74, 0x5d, 0xb0, 0x45, 0xfa, 0x30, 0x8b,
0xf4, 0x2b, 0xf4, 0xe1, 0x8e, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xdb, 0x60, 0x0c,
0x08, 0x00, 0x00, 0xff, 0xff, 0x61, 0x4b, 0x42, 0x58, 0xad, 0x00, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintParams(dAtA []byte, offset int, v uint64) int {
offset -= sovParams(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Params) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovParams(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozParams(x uint64) (n int) {
return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Params) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Params: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipParams(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthParams
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupParams
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthParams
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowParams = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: fungible/query.proto
package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// QueryParamsRequest is request type for the Query/Params RPC method.
type QueryParamsRequest struct {
}
func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{0}
}
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsRequest.Merge(m, src)
}
func (m *QueryParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo
// QueryParamsResponse is response type for the Query/Params RPC method.
type QueryParamsResponse struct {
// params holds all the parameters of this module.
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{1}
}
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsResponse.Merge(m, src)
}
func (m *QueryParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo
func (m *QueryParamsResponse) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
type QueryGetForeignCoinsRequest struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *QueryGetForeignCoinsRequest) Reset() { *m = QueryGetForeignCoinsRequest{} }
func (m *QueryGetForeignCoinsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetForeignCoinsRequest) ProtoMessage() {}
func (*QueryGetForeignCoinsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{2}
}
func (m *QueryGetForeignCoinsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetForeignCoinsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetForeignCoinsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetForeignCoinsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetForeignCoinsRequest.Merge(m, src)
}
func (m *QueryGetForeignCoinsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetForeignCoinsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetForeignCoinsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetForeignCoinsRequest proto.InternalMessageInfo
func (m *QueryGetForeignCoinsRequest) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
type QueryGetForeignCoinsResponse struct {
ForeignCoins ForeignCoins `protobuf:"bytes,1,opt,name=foreignCoins,proto3" json:"foreignCoins"`
}
func (m *QueryGetForeignCoinsResponse) Reset() { *m = QueryGetForeignCoinsResponse{} }
func (m *QueryGetForeignCoinsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetForeignCoinsResponse) ProtoMessage() {}
func (*QueryGetForeignCoinsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{3}
}
func (m *QueryGetForeignCoinsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetForeignCoinsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetForeignCoinsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetForeignCoinsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetForeignCoinsResponse.Merge(m, src)
}
func (m *QueryGetForeignCoinsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetForeignCoinsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetForeignCoinsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetForeignCoinsResponse proto.InternalMessageInfo
func (m *QueryGetForeignCoinsResponse) GetForeignCoins() ForeignCoins {
if m != nil {
return m.ForeignCoins
}
return ForeignCoins{}
}
type QueryAllForeignCoinsRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllForeignCoinsRequest) Reset() { *m = QueryAllForeignCoinsRequest{} }
func (m *QueryAllForeignCoinsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllForeignCoinsRequest) ProtoMessage() {}
func (*QueryAllForeignCoinsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{4}
}
func (m *QueryAllForeignCoinsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllForeignCoinsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllForeignCoinsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllForeignCoinsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllForeignCoinsRequest.Merge(m, src)
}
func (m *QueryAllForeignCoinsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllForeignCoinsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllForeignCoinsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllForeignCoinsRequest proto.InternalMessageInfo
func (m *QueryAllForeignCoinsRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllForeignCoinsResponse struct {
ForeignCoins []ForeignCoins `protobuf:"bytes,1,rep,name=foreignCoins,proto3" json:"foreignCoins"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllForeignCoinsResponse) Reset() { *m = QueryAllForeignCoinsResponse{} }
func (m *QueryAllForeignCoinsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllForeignCoinsResponse) ProtoMessage() {}
func (*QueryAllForeignCoinsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{5}
}
func (m *QueryAllForeignCoinsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllForeignCoinsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllForeignCoinsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllForeignCoinsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllForeignCoinsResponse.Merge(m, src)
}
func (m *QueryAllForeignCoinsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllForeignCoinsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllForeignCoinsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllForeignCoinsResponse proto.InternalMessageInfo
func (m *QueryAllForeignCoinsResponse) GetForeignCoins() []ForeignCoins {
if m != nil {
return m.ForeignCoins
}
return nil
}
func (m *QueryAllForeignCoinsResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryGetSystemContractRequest struct {
}
func (m *QueryGetSystemContractRequest) Reset() { *m = QueryGetSystemContractRequest{} }
func (m *QueryGetSystemContractRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetSystemContractRequest) ProtoMessage() {}
func (*QueryGetSystemContractRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{6}
}
func (m *QueryGetSystemContractRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetSystemContractRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetSystemContractRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetSystemContractRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetSystemContractRequest.Merge(m, src)
}
func (m *QueryGetSystemContractRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetSystemContractRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetSystemContractRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetSystemContractRequest proto.InternalMessageInfo
type QueryGetSystemContractResponse struct {
SystemContract SystemContract `protobuf:"bytes,1,opt,name=SystemContract,proto3" json:"SystemContract"`
}
func (m *QueryGetSystemContractResponse) Reset() { *m = QueryGetSystemContractResponse{} }
func (m *QueryGetSystemContractResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetSystemContractResponse) ProtoMessage() {}
func (*QueryGetSystemContractResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{7}
}
func (m *QueryGetSystemContractResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetSystemContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetSystemContractResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetSystemContractResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetSystemContractResponse.Merge(m, src)
}
func (m *QueryGetSystemContractResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetSystemContractResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetSystemContractResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetSystemContractResponse proto.InternalMessageInfo
func (m *QueryGetSystemContractResponse) GetSystemContract() SystemContract {
if m != nil {
return m.SystemContract
}
return SystemContract{}
}
type QueryGetGasStabilityPoolAddress struct {
}
func (m *QueryGetGasStabilityPoolAddress) Reset() { *m = QueryGetGasStabilityPoolAddress{} }
func (m *QueryGetGasStabilityPoolAddress) String() string { return proto.CompactTextString(m) }
func (*QueryGetGasStabilityPoolAddress) ProtoMessage() {}
func (*QueryGetGasStabilityPoolAddress) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{8}
}
func (m *QueryGetGasStabilityPoolAddress) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetGasStabilityPoolAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetGasStabilityPoolAddress.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetGasStabilityPoolAddress) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetGasStabilityPoolAddress.Merge(m, src)
}
func (m *QueryGetGasStabilityPoolAddress) XXX_Size() int {
return m.Size()
}
func (m *QueryGetGasStabilityPoolAddress) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetGasStabilityPoolAddress.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetGasStabilityPoolAddress proto.InternalMessageInfo
type QueryGetGasStabilityPoolAddressResponse struct {
CosmosAddress string `protobuf:"bytes,1,opt,name=cosmos_address,json=cosmosAddress,proto3" json:"cosmos_address,omitempty"`
EvmAddress string `protobuf:"bytes,2,opt,name=evm_address,json=evmAddress,proto3" json:"evm_address,omitempty"`
}
func (m *QueryGetGasStabilityPoolAddressResponse) Reset() {
*m = QueryGetGasStabilityPoolAddressResponse{}
}
func (m *QueryGetGasStabilityPoolAddressResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetGasStabilityPoolAddressResponse) ProtoMessage() {}
func (*QueryGetGasStabilityPoolAddressResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{9}
}
func (m *QueryGetGasStabilityPoolAddressResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetGasStabilityPoolAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetGasStabilityPoolAddressResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetGasStabilityPoolAddressResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetGasStabilityPoolAddressResponse.Merge(m, src)
}
func (m *QueryGetGasStabilityPoolAddressResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetGasStabilityPoolAddressResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetGasStabilityPoolAddressResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetGasStabilityPoolAddressResponse proto.InternalMessageInfo
func (m *QueryGetGasStabilityPoolAddressResponse) GetCosmosAddress() string {
if m != nil {
return m.CosmosAddress
}
return ""
}
func (m *QueryGetGasStabilityPoolAddressResponse) GetEvmAddress() string {
if m != nil {
return m.EvmAddress
}
return ""
}
type QueryGetGasStabilityPoolBalance struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *QueryGetGasStabilityPoolBalance) Reset() { *m = QueryGetGasStabilityPoolBalance{} }
func (m *QueryGetGasStabilityPoolBalance) String() string { return proto.CompactTextString(m) }
func (*QueryGetGasStabilityPoolBalance) ProtoMessage() {}
func (*QueryGetGasStabilityPoolBalance) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{10}
}
func (m *QueryGetGasStabilityPoolBalance) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetGasStabilityPoolBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetGasStabilityPoolBalance.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetGasStabilityPoolBalance) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetGasStabilityPoolBalance.Merge(m, src)
}
func (m *QueryGetGasStabilityPoolBalance) XXX_Size() int {
return m.Size()
}
func (m *QueryGetGasStabilityPoolBalance) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetGasStabilityPoolBalance.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetGasStabilityPoolBalance proto.InternalMessageInfo
func (m *QueryGetGasStabilityPoolBalance) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
type QueryGetGasStabilityPoolBalanceResponse struct {
Balance string `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance,omitempty"`
}
func (m *QueryGetGasStabilityPoolBalanceResponse) Reset() {
*m = QueryGetGasStabilityPoolBalanceResponse{}
}
func (m *QueryGetGasStabilityPoolBalanceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetGasStabilityPoolBalanceResponse) ProtoMessage() {}
func (*QueryGetGasStabilityPoolBalanceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{11}
}
func (m *QueryGetGasStabilityPoolBalanceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetGasStabilityPoolBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetGasStabilityPoolBalanceResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetGasStabilityPoolBalanceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetGasStabilityPoolBalanceResponse.Merge(m, src)
}
func (m *QueryGetGasStabilityPoolBalanceResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetGasStabilityPoolBalanceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetGasStabilityPoolBalanceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetGasStabilityPoolBalanceResponse proto.InternalMessageInfo
func (m *QueryGetGasStabilityPoolBalanceResponse) GetBalance() string {
if m != nil {
return m.Balance
}
return ""
}
type QueryAllGasStabilityPoolBalance struct {
}
func (m *QueryAllGasStabilityPoolBalance) Reset() { *m = QueryAllGasStabilityPoolBalance{} }
func (m *QueryAllGasStabilityPoolBalance) String() string { return proto.CompactTextString(m) }
func (*QueryAllGasStabilityPoolBalance) ProtoMessage() {}
func (*QueryAllGasStabilityPoolBalance) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{12}
}
func (m *QueryAllGasStabilityPoolBalance) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllGasStabilityPoolBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllGasStabilityPoolBalance.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllGasStabilityPoolBalance) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllGasStabilityPoolBalance.Merge(m, src)
}
func (m *QueryAllGasStabilityPoolBalance) XXX_Size() int {
return m.Size()
}
func (m *QueryAllGasStabilityPoolBalance) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllGasStabilityPoolBalance.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllGasStabilityPoolBalance proto.InternalMessageInfo
type QueryAllGasStabilityPoolBalanceResponse struct {
Balances []QueryAllGasStabilityPoolBalanceResponse_Balance `protobuf:"bytes,1,rep,name=balances,proto3" json:"balances"`
}
func (m *QueryAllGasStabilityPoolBalanceResponse) Reset() {
*m = QueryAllGasStabilityPoolBalanceResponse{}
}
func (m *QueryAllGasStabilityPoolBalanceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllGasStabilityPoolBalanceResponse) ProtoMessage() {}
func (*QueryAllGasStabilityPoolBalanceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{13}
}
func (m *QueryAllGasStabilityPoolBalanceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllGasStabilityPoolBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllGasStabilityPoolBalanceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse.Merge(m, src)
}
func (m *QueryAllGasStabilityPoolBalanceResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllGasStabilityPoolBalanceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse proto.InternalMessageInfo
func (m *QueryAllGasStabilityPoolBalanceResponse) GetBalances() []QueryAllGasStabilityPoolBalanceResponse_Balance {
if m != nil {
return m.Balances
}
return nil
}
type QueryAllGasStabilityPoolBalanceResponse_Balance struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Balance string `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance,omitempty"`
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) Reset() {
*m = QueryAllGasStabilityPoolBalanceResponse_Balance{}
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) String() string {
return proto.CompactTextString(m)
}
func (*QueryAllGasStabilityPoolBalanceResponse_Balance) ProtoMessage() {}
func (*QueryAllGasStabilityPoolBalanceResponse_Balance) Descriptor() ([]byte, []int) {
return fileDescriptor_d671b6e9298b37cd, []int{13, 0}
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse_Balance.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse_Balance.Merge(m, src)
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) XXX_Size() int {
return m.Size()
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse_Balance.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllGasStabilityPoolBalanceResponse_Balance proto.InternalMessageInfo
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) GetBalance() string {
if m != nil {
return m.Balance
}
return ""
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.fungible.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.fungible.QueryParamsResponse")
proto.RegisterType((*QueryGetForeignCoinsRequest)(nil), "zetachain.zetacore.fungible.QueryGetForeignCoinsRequest")
proto.RegisterType((*QueryGetForeignCoinsResponse)(nil), "zetachain.zetacore.fungible.QueryGetForeignCoinsResponse")
proto.RegisterType((*QueryAllForeignCoinsRequest)(nil), "zetachain.zetacore.fungible.QueryAllForeignCoinsRequest")
proto.RegisterType((*QueryAllForeignCoinsResponse)(nil), "zetachain.zetacore.fungible.QueryAllForeignCoinsResponse")
proto.RegisterType((*QueryGetSystemContractRequest)(nil), "zetachain.zetacore.fungible.QueryGetSystemContractRequest")
proto.RegisterType((*QueryGetSystemContractResponse)(nil), "zetachain.zetacore.fungible.QueryGetSystemContractResponse")
proto.RegisterType((*QueryGetGasStabilityPoolAddress)(nil), "zetachain.zetacore.fungible.QueryGetGasStabilityPoolAddress")
proto.RegisterType((*QueryGetGasStabilityPoolAddressResponse)(nil), "zetachain.zetacore.fungible.QueryGetGasStabilityPoolAddressResponse")
proto.RegisterType((*QueryGetGasStabilityPoolBalance)(nil), "zetachain.zetacore.fungible.QueryGetGasStabilityPoolBalance")
proto.RegisterType((*QueryGetGasStabilityPoolBalanceResponse)(nil), "zetachain.zetacore.fungible.QueryGetGasStabilityPoolBalanceResponse")
proto.RegisterType((*QueryAllGasStabilityPoolBalance)(nil), "zetachain.zetacore.fungible.QueryAllGasStabilityPoolBalance")
proto.RegisterType((*QueryAllGasStabilityPoolBalanceResponse)(nil), "zetachain.zetacore.fungible.QueryAllGasStabilityPoolBalanceResponse")
proto.RegisterType((*QueryAllGasStabilityPoolBalanceResponse_Balance)(nil), "zetachain.zetacore.fungible.QueryAllGasStabilityPoolBalanceResponse.Balance")
}
func init() { proto.RegisterFile("fungible/query.proto", fileDescriptor_d671b6e9298b37cd) }
var fileDescriptor_d671b6e9298b37cd = []byte{
// 846 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0x4d, 0x4f, 0xdb, 0x48,
0x18, 0xc7, 0x63, 0x58, 0x5e, 0x76, 0x60, 0x59, 0x69, 0x36, 0xab, 0x65, 0x0d, 0x38, 0xbb, 0x03,
0x0b, 0x5b, 0x4a, 0xed, 0x02, 0x87, 0x52, 0x1a, 0x55, 0x4d, 0xa8, 0x40, 0x48, 0x3d, 0xd0, 0x70,
0x69, 0x7b, 0x89, 0x26, 0xc9, 0x60, 0x2c, 0x39, 0x9e, 0x90, 0x71, 0x10, 0x29, 0xe2, 0xd2, 0x4f,
0x80, 0xd4, 0x6f, 0xd2, 0x4b, 0x2f, 0xfd, 0x00, 0x1c, 0x91, 0x2a, 0x55, 0xed, 0xa5, 0x6a, 0x43,
0xfb, 0x3d, 0xaa, 0x8c, 0x1f, 0x9b, 0x38, 0xb5, 0x13, 0x2b, 0xdc, 0xec, 0x99, 0xe7, 0xe5, 0xf7,
0x9f, 0x79, 0xfc, 0x4f, 0x50, 0xfa, 0xa0, 0xe1, 0x98, 0x56, 0xc9, 0x66, 0xc6, 0x51, 0x83, 0xd5,
0x9b, 0x7a, 0xad, 0xce, 0x5d, 0x8e, 0x67, 0x5e, 0x32, 0x97, 0x96, 0x0f, 0xa9, 0xe5, 0xe8, 0xf2,
0x89, 0xd7, 0x99, 0xee, 0x07, 0xaa, 0xcb, 0x65, 0x2e, 0xaa, 0x5c, 0x18, 0x25, 0x2a, 0x20, 0xcb,
0x38, 0x5e, 0x2d, 0x31, 0x97, 0xae, 0x1a, 0x35, 0x6a, 0x5a, 0x0e, 0x75, 0x2d, 0xee, 0x78, 0x85,
0xd4, 0xd9, 0xa0, 0xfc, 0x01, 0xaf, 0x33, 0xcb, 0x74, 0x8a, 0x65, 0x6e, 0x39, 0x02, 0x76, 0xff,
0x0c, 0x76, 0x6b, 0xb4, 0x4e, 0xab, 0xfe, 0xb2, 0x16, 0x2c, 0x8b, 0xa6, 0x70, 0x59, 0xb5, 0x58,
0xe6, 0x8e, 0x5b, 0xa7, 0x65, 0x17, 0xf6, 0xd3, 0x26, 0x37, 0xb9, 0x7c, 0x34, 0xda, 0x4f, 0x7e,
0x2b, 0x93, 0x73, 0xd3, 0x66, 0x06, 0xad, 0x59, 0x06, 0x75, 0x1c, 0xee, 0x4a, 0x0e, 0xa8, 0x49,
0xd2, 0x08, 0x3f, 0x6d, 0xa3, 0xee, 0xc9, 0x46, 0x05, 0x76, 0xd4, 0x60, 0xc2, 0x25, 0xcf, 0xd0,
0x1f, 0xa1, 0x55, 0x51, 0xe3, 0x8e, 0x60, 0x38, 0x87, 0x46, 0x3d, 0xa0, 0x69, 0xe5, 0x1f, 0xe5,
0xff, 0x89, 0xb5, 0x79, 0xbd, 0xc7, 0x79, 0xe8, 0x5e, 0x72, 0xfe, 0x97, 0x8b, 0xcf, 0x99, 0x54,
0x01, 0x12, 0xc9, 0x3a, 0x9a, 0x91, 0x95, 0x77, 0x98, 0xbb, 0xed, 0x29, 0xdf, 0x6a, 0x0b, 0x87,
0xc6, 0x38, 0x8d, 0x46, 0x2c, 0xa7, 0xc2, 0x4e, 0x64, 0x83, 0x5f, 0x0b, 0xde, 0x0b, 0x11, 0x68,
0x36, 0x3a, 0x09, 0xb8, 0xf6, 0xd1, 0xe4, 0x41, 0xc7, 0x3a, 0xd0, 0xdd, 0xea, 0x49, 0xd7, 0x59,
0x08, 0x18, 0x43, 0x45, 0x08, 0x03, 0xd2, 0x9c, 0x6d, 0x47, 0x91, 0x6e, 0x23, 0x74, 0x7d, 0xab,
0xd0, 0x71, 0x51, 0xf7, 0x46, 0x40, 0x6f, 0x8f, 0x80, 0xee, 0x0d, 0x0e, 0x8c, 0x80, 0xbe, 0x47,
0x4d, 0x06, 0xb9, 0x85, 0x8e, 0x4c, 0xf2, 0x4e, 0x01, 0x71, 0x3f, 0xf5, 0x89, 0x15, 0x37, 0x7c,
0x63, 0x71, 0x78, 0x27, 0x44, 0x3f, 0x24, 0xe9, 0x97, 0xfa, 0xd2, 0x7b, 0x44, 0x21, 0xfc, 0x0c,
0x9a, 0xf3, 0xaf, 0x66, 0x5f, 0x0e, 0xe5, 0x16, 0xcc, 0xa4, 0x3f, 0x4a, 0xa7, 0x48, 0x8b, 0x0b,
0x00, 0x81, 0xcf, 0xd1, 0x54, 0x78, 0x07, 0x4e, 0xf3, 0x76, 0x4f, 0x89, 0xe1, 0x14, 0x10, 0xd9,
0x55, 0x88, 0xfc, 0x8b, 0x32, 0x7e, 0xf3, 0x1d, 0x2a, 0xf6, 0x5d, 0x5a, 0xb2, 0x6c, 0xcb, 0x6d,
0xee, 0x71, 0x6e, 0xe7, 0x2a, 0x95, 0x3a, 0x13, 0x82, 0x1c, 0xa1, 0xa5, 0x3e, 0x21, 0x01, 0xe8,
0x7f, 0x68, 0xca, 0x3b, 0xa1, 0x22, 0xf5, 0x76, 0x60, 0x4a, 0x7f, 0xf3, 0x56, 0x21, 0x1c, 0x67,
0xd0, 0x04, 0x3b, 0xae, 0x06, 0x31, 0x43, 0x32, 0x06, 0xb1, 0xe3, 0xaa, 0xdf, 0x32, 0x1b, 0x4f,
0x95, 0xa7, 0x36, 0x75, 0xca, 0x0c, 0xff, 0x8d, 0xc6, 0xa5, 0xf0, 0xa2, 0x55, 0x91, 0x4d, 0x86,
0x0b, 0x63, 0xf2, 0x7d, 0xb7, 0x42, 0xb6, 0xe2, 0x81, 0x21, 0x3b, 0x00, 0x9e, 0x46, 0x63, 0x25,
0x6f, 0x09, 0x28, 0xfc, 0xd7, 0xe0, 0x60, 0x72, 0xb6, 0x1d, 0x53, 0x84, 0x7c, 0x52, 0xa0, 0x51,
0x7c, 0x4c, 0xd0, 0xc8, 0x41, 0xe3, 0x50, 0xd9, 0x9f, 0xcf, 0x27, 0x3d, 0x2f, 0x2f, 0x61, 0x5d,
0x1d, 0xde, 0xe1, 0x76, 0x83, 0x1e, 0xea, 0x43, 0x34, 0xd6, 0xff, 0xa4, 0xe2, 0xe5, 0xaf, 0x7d,
0x47, 0x68, 0x44, 0x32, 0xe0, 0x73, 0x05, 0x8d, 0x7a, 0x46, 0x85, 0x8d, 0xfe, 0xc8, 0x21, 0x97,
0x54, 0xef, 0x26, 0x4f, 0xf0, 0xf4, 0x90, 0xf9, 0x57, 0xef, 0xbf, 0xbd, 0x1e, 0x9a, 0xc3, 0x33,
0x46, 0x3b, 0xfe, 0x8e, 0x4c, 0x35, 0xba, 0xcc, 0x1e, 0xbf, 0x55, 0xd0, 0x64, 0xe7, 0x07, 0x8c,
0x37, 0xfa, 0xf7, 0x89, 0xb6, 0x53, 0xf5, 0xfe, 0x00, 0x99, 0x80, 0xba, 0x26, 0x51, 0x57, 0xf0,
0x72, 0x24, 0x6a, 0xe8, 0x57, 0xcb, 0x38, 0x95, 0x36, 0x7d, 0x86, 0xdf, 0x28, 0xe8, 0xf7, 0xce,
0x62, 0x39, 0xdb, 0x4e, 0x02, 0x1f, 0xed, 0xb0, 0x49, 0xe0, 0x63, 0x3c, 0x93, 0x2c, 0x4b, 0xf8,
0x05, 0x4c, 0xfa, 0xc3, 0xb7, 0x8f, 0xbb, 0xcb, 0x36, 0xf0, 0x66, 0xa2, 0x63, 0x8b, 0xf4, 0x3b,
0xf5, 0xc1, 0x40, 0xb9, 0xc0, 0xbd, 0x22, 0xb9, 0x17, 0xf1, 0x42, 0x24, 0x77, 0xd7, 0xaf, 0x3e,
0xfe, 0xa0, 0xa0, 0xbf, 0x62, 0x3c, 0x0b, 0x67, 0x13, 0x61, 0xc4, 0x64, 0xab, 0x8f, 0x6f, 0x92,
0x1d, 0xa8, 0xb9, 0x27, 0xd5, 0xac, 0x62, 0x23, 0x52, 0x8d, 0x49, 0x45, 0x51, 0xf8, 0xe9, 0xc5,
0x1a, 0xe7, 0xb6, 0x6f, 0x99, 0xf8, 0x6b, 0x84, 0x30, 0xff, 0x7b, 0x1f, 0x4c, 0x18, 0x64, 0x0f,
0x28, 0xac, 0xcb, 0x96, 0x48, 0x5e, 0x0a, 0xcb, 0xe2, 0xcd, 0xa4, 0xc2, 0xc0, 0x77, 0x8c, 0x53,
0xdf, 0xaa, 0xce, 0x70, 0x4b, 0x41, 0x6a, 0x4c, 0x9f, 0xf6, 0x67, 0x93, 0xbd, 0x89, 0x7f, 0x26,
0x91, 0xd9, 0xdf, 0x7d, 0xc9, 0x23, 0x29, 0x73, 0x13, 0x6f, 0x74, 0xca, 0xf4, 0xcb, 0x25, 0xd1,
0x9b, 0xdf, 0xbd, 0x68, 0x69, 0xca, 0x65, 0x4b, 0x53, 0xbe, 0xb4, 0x34, 0xe5, 0xfc, 0x4a, 0x4b,
0x5d, 0x5e, 0x69, 0xa9, 0x8f, 0x57, 0x5a, 0xea, 0x85, 0x61, 0x5a, 0xee, 0x61, 0xa3, 0xa4, 0x97,
0x79, 0x35, 0xb2, 0xfa, 0xc9, 0x75, 0x7d, 0xb7, 0x59, 0x63, 0xa2, 0x34, 0x2a, 0xff, 0xaf, 0xae,
0xff, 0x08, 0x00, 0x00, 0xff, 0xff, 0x88, 0x06, 0xca, 0xa7, 0x99, 0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type QueryClient interface {
// Parameters queries the parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Queries a ForeignCoins by index.
ForeignCoins(ctx context.Context, in *QueryGetForeignCoinsRequest, opts ...grpc.CallOption) (*QueryGetForeignCoinsResponse, error)
// Queries a list of ForeignCoins items.
ForeignCoinsAll(ctx context.Context, in *QueryAllForeignCoinsRequest, opts ...grpc.CallOption) (*QueryAllForeignCoinsResponse, error)
// Queries SystemContract
SystemContract(ctx context.Context, in *QueryGetSystemContractRequest, opts ...grpc.CallOption) (*QueryGetSystemContractResponse, error)
// Queries the address of a gas stability pool on a given chain.
GasStabilityPoolAddress(ctx context.Context, in *QueryGetGasStabilityPoolAddress, opts ...grpc.CallOption) (*QueryGetGasStabilityPoolAddressResponse, error)
// Queries the balance of a gas stability pool on a given chain.
GasStabilityPoolBalance(ctx context.Context, in *QueryGetGasStabilityPoolBalance, opts ...grpc.CallOption) (*QueryGetGasStabilityPoolBalanceResponse, error)
// Queries all gas stability pool balances.
GasStabilityPoolBalanceAll(ctx context.Context, in *QueryAllGasStabilityPoolBalance, opts ...grpc.CallOption) (*QueryAllGasStabilityPoolBalanceResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ForeignCoins(ctx context.Context, in *QueryGetForeignCoinsRequest, opts ...grpc.CallOption) (*QueryGetForeignCoinsResponse, error) {
out := new(QueryGetForeignCoinsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/ForeignCoins", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ForeignCoinsAll(ctx context.Context, in *QueryAllForeignCoinsRequest, opts ...grpc.CallOption) (*QueryAllForeignCoinsResponse, error) {
out := new(QueryAllForeignCoinsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/ForeignCoinsAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) SystemContract(ctx context.Context, in *QueryGetSystemContractRequest, opts ...grpc.CallOption) (*QueryGetSystemContractResponse, error) {
out := new(QueryGetSystemContractResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/SystemContract", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GasStabilityPoolAddress(ctx context.Context, in *QueryGetGasStabilityPoolAddress, opts ...grpc.CallOption) (*QueryGetGasStabilityPoolAddressResponse, error) {
out := new(QueryGetGasStabilityPoolAddressResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/GasStabilityPoolAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GasStabilityPoolBalance(ctx context.Context, in *QueryGetGasStabilityPoolBalance, opts ...grpc.CallOption) (*QueryGetGasStabilityPoolBalanceResponse, error) {
out := new(QueryGetGasStabilityPoolBalanceResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/GasStabilityPoolBalance", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GasStabilityPoolBalanceAll(ctx context.Context, in *QueryAllGasStabilityPoolBalance, opts ...grpc.CallOption) (*QueryAllGasStabilityPoolBalanceResponse, error) {
out := new(QueryAllGasStabilityPoolBalanceResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/GasStabilityPoolBalanceAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Parameters queries the parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Queries a ForeignCoins by index.
ForeignCoins(context.Context, *QueryGetForeignCoinsRequest) (*QueryGetForeignCoinsResponse, error)
// Queries a list of ForeignCoins items.
ForeignCoinsAll(context.Context, *QueryAllForeignCoinsRequest) (*QueryAllForeignCoinsResponse, error)
// Queries SystemContract
SystemContract(context.Context, *QueryGetSystemContractRequest) (*QueryGetSystemContractResponse, error)
// Queries the address of a gas stability pool on a given chain.
GasStabilityPoolAddress(context.Context, *QueryGetGasStabilityPoolAddress) (*QueryGetGasStabilityPoolAddressResponse, error)
// Queries the balance of a gas stability pool on a given chain.
GasStabilityPoolBalance(context.Context, *QueryGetGasStabilityPoolBalance) (*QueryGetGasStabilityPoolBalanceResponse, error)
// Queries all gas stability pool balances.
GasStabilityPoolBalanceAll(context.Context, *QueryAllGasStabilityPoolBalance) (*QueryAllGasStabilityPoolBalanceResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) ForeignCoins(ctx context.Context, req *QueryGetForeignCoinsRequest) (*QueryGetForeignCoinsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ForeignCoins not implemented")
}
func (*UnimplementedQueryServer) ForeignCoinsAll(ctx context.Context, req *QueryAllForeignCoinsRequest) (*QueryAllForeignCoinsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ForeignCoinsAll not implemented")
}
func (*UnimplementedQueryServer) SystemContract(ctx context.Context, req *QueryGetSystemContractRequest) (*QueryGetSystemContractResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SystemContract not implemented")
}
func (*UnimplementedQueryServer) GasStabilityPoolAddress(ctx context.Context, req *QueryGetGasStabilityPoolAddress) (*QueryGetGasStabilityPoolAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GasStabilityPoolAddress not implemented")
}
func (*UnimplementedQueryServer) GasStabilityPoolBalance(ctx context.Context, req *QueryGetGasStabilityPoolBalance) (*QueryGetGasStabilityPoolBalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GasStabilityPoolBalance not implemented")
}
func (*UnimplementedQueryServer) GasStabilityPoolBalanceAll(ctx context.Context, req *QueryAllGasStabilityPoolBalance) (*QueryAllGasStabilityPoolBalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GasStabilityPoolBalanceAll not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ForeignCoins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetForeignCoinsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ForeignCoins(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Query/ForeignCoins",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ForeignCoins(ctx, req.(*QueryGetForeignCoinsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ForeignCoinsAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllForeignCoinsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ForeignCoinsAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Query/ForeignCoinsAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ForeignCoinsAll(ctx, req.(*QueryAllForeignCoinsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_SystemContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetSystemContractRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).SystemContract(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Query/SystemContract",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).SystemContract(ctx, req.(*QueryGetSystemContractRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GasStabilityPoolAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetGasStabilityPoolAddress)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GasStabilityPoolAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Query/GasStabilityPoolAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GasStabilityPoolAddress(ctx, req.(*QueryGetGasStabilityPoolAddress))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GasStabilityPoolBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetGasStabilityPoolBalance)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GasStabilityPoolBalance(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Query/GasStabilityPoolBalance",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GasStabilityPoolBalance(ctx, req.(*QueryGetGasStabilityPoolBalance))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GasStabilityPoolBalanceAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllGasStabilityPoolBalance)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GasStabilityPoolBalanceAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Query/GasStabilityPoolBalanceAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GasStabilityPoolBalanceAll(ctx, req.(*QueryAllGasStabilityPoolBalance))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.fungible.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "ForeignCoins",
Handler: _Query_ForeignCoins_Handler,
},
{
MethodName: "ForeignCoinsAll",
Handler: _Query_ForeignCoinsAll_Handler,
},
{
MethodName: "SystemContract",
Handler: _Query_SystemContract_Handler,
},
{
MethodName: "GasStabilityPoolAddress",
Handler: _Query_GasStabilityPoolAddress_Handler,
},
{
MethodName: "GasStabilityPoolBalance",
Handler: _Query_GasStabilityPoolBalance_Handler,
},
{
MethodName: "GasStabilityPoolBalanceAll",
Handler: _Query_GasStabilityPoolBalanceAll_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "fungible/query.proto",
}
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryGetForeignCoinsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetForeignCoinsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetForeignCoinsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetForeignCoinsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetForeignCoinsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetForeignCoinsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.ForeignCoins.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryAllForeignCoinsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllForeignCoinsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllForeignCoinsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllForeignCoinsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllForeignCoinsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllForeignCoinsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.ForeignCoins) > 0 {
for iNdEx := len(m.ForeignCoins) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.ForeignCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetSystemContractRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetSystemContractRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetSystemContractRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryGetSystemContractResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetSystemContractResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetSystemContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.SystemContract.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryGetGasStabilityPoolAddress) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetGasStabilityPoolAddress) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetGasStabilityPoolAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryGetGasStabilityPoolAddressResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetGasStabilityPoolAddressResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetGasStabilityPoolAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.EvmAddress) > 0 {
i -= len(m.EvmAddress)
copy(dAtA[i:], m.EvmAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.EvmAddress)))
i--
dAtA[i] = 0x12
}
if len(m.CosmosAddress) > 0 {
i -= len(m.CosmosAddress)
copy(dAtA[i:], m.CosmosAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmosAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetGasStabilityPoolBalance) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetGasStabilityPoolBalance) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetGasStabilityPoolBalance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryGetGasStabilityPoolBalanceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetGasStabilityPoolBalanceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetGasStabilityPoolBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Balance) > 0 {
i -= len(m.Balance)
copy(dAtA[i:], m.Balance)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance)))
i--
dAtA[i] = 0x12
}
return len(dAtA) - i, nil
}
func (m *QueryAllGasStabilityPoolBalance) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllGasStabilityPoolBalance) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllGasStabilityPoolBalance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryAllGasStabilityPoolBalanceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllGasStabilityPoolBalanceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllGasStabilityPoolBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Balances) > 0 {
for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Balances[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Balance) > 0 {
i -= len(m.Balance)
copy(dAtA[i:], m.Balance)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance)))
i--
dAtA[i] = 0x12
}
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *QueryParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryGetForeignCoinsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetForeignCoinsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.ForeignCoins.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryAllForeignCoinsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllForeignCoinsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.ForeignCoins) > 0 {
for _, e := range m.ForeignCoins {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetSystemContractRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryGetSystemContractResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.SystemContract.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryGetGasStabilityPoolAddress) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryGetGasStabilityPoolAddressResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.CosmosAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.EvmAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetGasStabilityPoolBalance) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
return n
}
func (m *QueryGetGasStabilityPoolBalanceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Balance)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllGasStabilityPoolBalance) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryAllGasStabilityPoolBalanceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Balances) > 0 {
for _, e := range m.Balances {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
l = len(m.Balance)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetForeignCoinsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetForeignCoinsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetForeignCoinsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetForeignCoinsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetForeignCoinsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetForeignCoinsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ForeignCoins", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ForeignCoins.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllForeignCoinsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllForeignCoinsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllForeignCoinsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllForeignCoinsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllForeignCoinsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllForeignCoinsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ForeignCoins", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ForeignCoins = append(m.ForeignCoins, ForeignCoins{})
if err := m.ForeignCoins[len(m.ForeignCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetSystemContractRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetSystemContractRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetSystemContractRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetSystemContractResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetSystemContractResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetSystemContractResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SystemContract", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.SystemContract.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetGasStabilityPoolAddress) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolAddress: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolAddress: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetGasStabilityPoolAddressResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolAddressResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CosmosAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CosmosAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EvmAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.EvmAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetGasStabilityPoolBalance) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolBalance: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolBalance: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetGasStabilityPoolBalanceResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolBalanceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetGasStabilityPoolBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balance = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllGasStabilityPoolBalance) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllGasStabilityPoolBalance: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllGasStabilityPoolBalance: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllGasStabilityPoolBalanceResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllGasStabilityPoolBalanceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllGasStabilityPoolBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Balances", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balances = append(m.Balances, QueryAllGasStabilityPoolBalanceResponse_Balance{})
if err := m.Balances[len(m.Balances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Balance: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Balance: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balance = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthQuery
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupQuery
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthQuery
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: fungible/query.proto
/*
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package types
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := server.Params(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_ForeignCoins_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetForeignCoinsRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := client.ForeignCoins(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ForeignCoins_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetForeignCoinsRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := server.ForeignCoins(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_ForeignCoinsAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_ForeignCoinsAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllForeignCoinsRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ForeignCoinsAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ForeignCoinsAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ForeignCoinsAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllForeignCoinsRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ForeignCoinsAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ForeignCoinsAll(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_SystemContract_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetSystemContractRequest
var metadata runtime.ServerMetadata
msg, err := client.SystemContract(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_SystemContract_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetSystemContractRequest
var metadata runtime.ServerMetadata
msg, err := server.SystemContract(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GasStabilityPoolAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetGasStabilityPoolAddress
var metadata runtime.ServerMetadata
msg, err := client.GasStabilityPoolAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GasStabilityPoolAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetGasStabilityPoolAddress
var metadata runtime.ServerMetadata
msg, err := server.GasStabilityPoolAddress(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GasStabilityPoolBalance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetGasStabilityPoolBalance
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
msg, err := client.GasStabilityPoolBalance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GasStabilityPoolBalance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetGasStabilityPoolBalance
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
msg, err := server.GasStabilityPoolBalance(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GasStabilityPoolBalanceAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllGasStabilityPoolBalance
var metadata runtime.ServerMetadata
msg, err := client.GasStabilityPoolBalanceAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GasStabilityPoolBalanceAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllGasStabilityPoolBalance
var metadata runtime.ServerMetadata
msg, err := server.GasStabilityPoolBalanceAll(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ForeignCoins_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ForeignCoins_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ForeignCoins_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ForeignCoinsAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ForeignCoinsAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ForeignCoinsAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_SystemContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_SystemContract_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_SystemContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasStabilityPoolAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GasStabilityPoolAddress_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasStabilityPoolAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasStabilityPoolBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GasStabilityPoolBalance_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasStabilityPoolBalance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasStabilityPoolBalanceAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GasStabilityPoolBalanceAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasStabilityPoolBalanceAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterQueryHandler(ctx, mux, conn)
}
// RegisterQueryHandler registers the http handlers for service Query to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
}
// RegisterQueryHandlerClient registers the http handlers for service Query
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ForeignCoins_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ForeignCoins_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ForeignCoins_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ForeignCoinsAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ForeignCoinsAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ForeignCoinsAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_SystemContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_SystemContract_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_SystemContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasStabilityPoolAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GasStabilityPoolAddress_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasStabilityPoolAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasStabilityPoolBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GasStabilityPoolBalance_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasStabilityPoolBalance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GasStabilityPoolBalanceAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GasStabilityPoolBalanceAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GasStabilityPoolBalanceAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "fungible", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ForeignCoins_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "fungible", "foreign_coins", "index"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ForeignCoinsAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "fungible", "foreign_coins"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_SystemContract_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "fungible", "system_contract"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GasStabilityPoolAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "fungible", "gas_stability_pool_address"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GasStabilityPoolBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "fungible", "gas_stability_pool_balance", "chain_id"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GasStabilityPoolBalanceAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"zeta-chain", "zetacore", "fungible", "gas_stability_pool_balance"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_ForeignCoins_0 = runtime.ForwardResponseMessage
forward_Query_ForeignCoinsAll_0 = runtime.ForwardResponseMessage
forward_Query_SystemContract_0 = runtime.ForwardResponseMessage
forward_Query_GasStabilityPoolAddress_0 = runtime.ForwardResponseMessage
forward_Query_GasStabilityPoolBalance_0 = runtime.ForwardResponseMessage
forward_Query_GasStabilityPoolBalanceAll_0 = runtime.ForwardResponseMessage
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: fungible/system_contract.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type SystemContract struct {
SystemContract string `protobuf:"bytes,1,opt,name=system_contract,json=systemContract,proto3" json:"system_contract,omitempty"`
ConnectorZevm string `protobuf:"bytes,2,opt,name=connector_zevm,json=connectorZevm,proto3" json:"connector_zevm,omitempty"`
}
func (m *SystemContract) Reset() { *m = SystemContract{} }
func (m *SystemContract) String() string { return proto.CompactTextString(m) }
func (*SystemContract) ProtoMessage() {}
func (*SystemContract) Descriptor() ([]byte, []int) {
return fileDescriptor_77f5a98f5a394318, []int{0}
}
func (m *SystemContract) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *SystemContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_SystemContract.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *SystemContract) XXX_Merge(src proto.Message) {
xxx_messageInfo_SystemContract.Merge(m, src)
}
func (m *SystemContract) XXX_Size() int {
return m.Size()
}
func (m *SystemContract) XXX_DiscardUnknown() {
xxx_messageInfo_SystemContract.DiscardUnknown(m)
}
var xxx_messageInfo_SystemContract proto.InternalMessageInfo
func (m *SystemContract) GetSystemContract() string {
if m != nil {
return m.SystemContract
}
return ""
}
func (m *SystemContract) GetConnectorZevm() string {
if m != nil {
return m.ConnectorZevm
}
return ""
}
func init() {
proto.RegisterType((*SystemContract)(nil), "zetachain.zetacore.fungible.SystemContract")
}
func init() { proto.RegisterFile("fungible/system_contract.proto", fileDescriptor_77f5a98f5a394318) }
var fileDescriptor_77f5a98f5a394318 = []byte{
// 209 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x2b, 0xcd, 0x4b,
0xcf, 0x4c, 0xca, 0x49, 0xd5, 0x2f, 0xae, 0x2c, 0x2e, 0x49, 0xcd, 0x8d, 0x4f, 0xce, 0xcf, 0x2b,
0x29, 0x4a, 0x4c, 0x2e, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49,
0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x5a, 0xa4, 0x44,
0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, 0x2c, 0x88, 0x16, 0xa5, 0x04, 0x2e, 0xbe, 0x60,
0xb0, 0x59, 0xce, 0x50, 0xa3, 0x84, 0xd4, 0xb9, 0xf8, 0xd1, 0x4c, 0x97, 0x60, 0x54, 0x60, 0xd4,
0xe0, 0x0c, 0xe2, 0x2b, 0x46, 0x55, 0xa8, 0xca, 0xc5, 0x97, 0x9c, 0x9f, 0x97, 0x97, 0x9a, 0x5c,
0x92, 0x5f, 0x14, 0x5f, 0x95, 0x5a, 0x96, 0x2b, 0xc1, 0x04, 0x56, 0xc7, 0x0b, 0x17, 0x8d, 0x4a,
0x2d, 0xcb, 0x75, 0xf2, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4,
0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xfd,
0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x90, 0x7b, 0x75, 0xc1, 0x4e,
0xd7, 0x87, 0x39, 0x5d, 0xbf, 0x42, 0x1f, 0xee, 0xdf, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36,
0xb0, 0x9b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6e, 0xf5, 0xf0, 0xfd, 0x08, 0x01, 0x00,
0x00,
}
func (m *SystemContract) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *SystemContract) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SystemContract) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ConnectorZevm) > 0 {
i -= len(m.ConnectorZevm)
copy(dAtA[i:], m.ConnectorZevm)
i = encodeVarintSystemContract(dAtA, i, uint64(len(m.ConnectorZevm)))
i--
dAtA[i] = 0x12
}
if len(m.SystemContract) > 0 {
i -= len(m.SystemContract)
copy(dAtA[i:], m.SystemContract)
i = encodeVarintSystemContract(dAtA, i, uint64(len(m.SystemContract)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintSystemContract(dAtA []byte, offset int, v uint64) int {
offset -= sovSystemContract(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *SystemContract) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.SystemContract)
if l > 0 {
n += 1 + l + sovSystemContract(uint64(l))
}
l = len(m.ConnectorZevm)
if l > 0 {
n += 1 + l + sovSystemContract(uint64(l))
}
return n
}
func sovSystemContract(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozSystemContract(x uint64) (n int) {
return sovSystemContract(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *SystemContract) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSystemContract
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: SystemContract: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: SystemContract: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SystemContract", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSystemContract
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthSystemContract
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthSystemContract
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SystemContract = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ConnectorZevm", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSystemContract
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthSystemContract
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthSystemContract
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ConnectorZevm = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipSystemContract(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthSystemContract
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipSystemContract(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowSystemContract
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowSystemContract
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowSystemContract
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthSystemContract
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupSystemContract
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthSystemContract
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthSystemContract = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowSystemContract = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupSystemContract = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: fungible/tx.proto
package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type UpdatePausedStatusAction int32
const (
UpdatePausedStatusAction_PAUSE UpdatePausedStatusAction = 0
UpdatePausedStatusAction_UNPAUSE UpdatePausedStatusAction = 1
)
var UpdatePausedStatusAction_name = map[int32]string{
0: "PAUSE",
1: "UNPAUSE",
}
var UpdatePausedStatusAction_value = map[string]int32{
"PAUSE": 0,
"UNPAUSE": 1,
}
func (x UpdatePausedStatusAction) String() string {
return proto.EnumName(UpdatePausedStatusAction_name, int32(x))
}
func (UpdatePausedStatusAction) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{0}
}
type MsgUpdateZRC20WithdrawFee struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Zrc20Address string `protobuf:"bytes,2,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"`
NewWithdrawFee github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=new_withdraw_fee,json=newWithdrawFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"new_withdraw_fee"`
NewGasLimit github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,7,opt,name=new_gas_limit,json=newGasLimit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"new_gas_limit"`
}
func (m *MsgUpdateZRC20WithdrawFee) Reset() { *m = MsgUpdateZRC20WithdrawFee{} }
func (m *MsgUpdateZRC20WithdrawFee) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateZRC20WithdrawFee) ProtoMessage() {}
func (*MsgUpdateZRC20WithdrawFee) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{0}
}
func (m *MsgUpdateZRC20WithdrawFee) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateZRC20WithdrawFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateZRC20WithdrawFee.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateZRC20WithdrawFee) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateZRC20WithdrawFee.Merge(m, src)
}
func (m *MsgUpdateZRC20WithdrawFee) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateZRC20WithdrawFee) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateZRC20WithdrawFee.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateZRC20WithdrawFee proto.InternalMessageInfo
func (m *MsgUpdateZRC20WithdrawFee) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateZRC20WithdrawFee) GetZrc20Address() string {
if m != nil {
return m.Zrc20Address
}
return ""
}
type MsgUpdateZRC20WithdrawFeeResponse struct {
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) Reset() { *m = MsgUpdateZRC20WithdrawFeeResponse{} }
func (m *MsgUpdateZRC20WithdrawFeeResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateZRC20WithdrawFeeResponse) ProtoMessage() {}
func (*MsgUpdateZRC20WithdrawFeeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{1}
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse.Merge(m, src)
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse proto.InternalMessageInfo
type MsgUpdateSystemContract struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
NewSystemContractAddress string `protobuf:"bytes,2,opt,name=new_system_contract_address,json=newSystemContractAddress,proto3" json:"new_system_contract_address,omitempty"`
}
func (m *MsgUpdateSystemContract) Reset() { *m = MsgUpdateSystemContract{} }
func (m *MsgUpdateSystemContract) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateSystemContract) ProtoMessage() {}
func (*MsgUpdateSystemContract) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{2}
}
func (m *MsgUpdateSystemContract) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateSystemContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateSystemContract.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateSystemContract) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateSystemContract.Merge(m, src)
}
func (m *MsgUpdateSystemContract) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateSystemContract) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateSystemContract.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateSystemContract proto.InternalMessageInfo
func (m *MsgUpdateSystemContract) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateSystemContract) GetNewSystemContractAddress() string {
if m != nil {
return m.NewSystemContractAddress
}
return ""
}
type MsgUpdateSystemContractResponse struct {
}
func (m *MsgUpdateSystemContractResponse) Reset() { *m = MsgUpdateSystemContractResponse{} }
func (m *MsgUpdateSystemContractResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateSystemContractResponse) ProtoMessage() {}
func (*MsgUpdateSystemContractResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{3}
}
func (m *MsgUpdateSystemContractResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateSystemContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateSystemContractResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateSystemContractResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateSystemContractResponse.Merge(m, src)
}
func (m *MsgUpdateSystemContractResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateSystemContractResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateSystemContractResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateSystemContractResponse proto.InternalMessageInfo
type MsgDeployFungibleCoinZRC20 struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ERC20 string `protobuf:"bytes,2,opt,name=ERC20,proto3" json:"ERC20,omitempty"`
ForeignChainId int64 `protobuf:"varint,3,opt,name=foreign_chain_id,json=foreignChainId,proto3" json:"foreign_chain_id,omitempty"`
Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"`
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"`
CoinType common.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"`
GasLimit int64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
}
func (m *MsgDeployFungibleCoinZRC20) Reset() { *m = MsgDeployFungibleCoinZRC20{} }
func (m *MsgDeployFungibleCoinZRC20) String() string { return proto.CompactTextString(m) }
func (*MsgDeployFungibleCoinZRC20) ProtoMessage() {}
func (*MsgDeployFungibleCoinZRC20) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{4}
}
func (m *MsgDeployFungibleCoinZRC20) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgDeployFungibleCoinZRC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgDeployFungibleCoinZRC20.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgDeployFungibleCoinZRC20) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgDeployFungibleCoinZRC20.Merge(m, src)
}
func (m *MsgDeployFungibleCoinZRC20) XXX_Size() int {
return m.Size()
}
func (m *MsgDeployFungibleCoinZRC20) XXX_DiscardUnknown() {
xxx_messageInfo_MsgDeployFungibleCoinZRC20.DiscardUnknown(m)
}
var xxx_messageInfo_MsgDeployFungibleCoinZRC20 proto.InternalMessageInfo
func (m *MsgDeployFungibleCoinZRC20) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgDeployFungibleCoinZRC20) GetERC20() string {
if m != nil {
return m.ERC20
}
return ""
}
func (m *MsgDeployFungibleCoinZRC20) GetForeignChainId() int64 {
if m != nil {
return m.ForeignChainId
}
return 0
}
func (m *MsgDeployFungibleCoinZRC20) GetDecimals() uint32 {
if m != nil {
return m.Decimals
}
return 0
}
func (m *MsgDeployFungibleCoinZRC20) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *MsgDeployFungibleCoinZRC20) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
func (m *MsgDeployFungibleCoinZRC20) GetCoinType() common.CoinType {
if m != nil {
return m.CoinType
}
return common.CoinType_Zeta
}
func (m *MsgDeployFungibleCoinZRC20) GetGasLimit() int64 {
if m != nil {
return m.GasLimit
}
return 0
}
type MsgDeployFungibleCoinZRC20Response struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
}
func (m *MsgDeployFungibleCoinZRC20Response) Reset() { *m = MsgDeployFungibleCoinZRC20Response{} }
func (m *MsgDeployFungibleCoinZRC20Response) String() string { return proto.CompactTextString(m) }
func (*MsgDeployFungibleCoinZRC20Response) ProtoMessage() {}
func (*MsgDeployFungibleCoinZRC20Response) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{5}
}
func (m *MsgDeployFungibleCoinZRC20Response) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgDeployFungibleCoinZRC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgDeployFungibleCoinZRC20Response.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgDeployFungibleCoinZRC20Response) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgDeployFungibleCoinZRC20Response.Merge(m, src)
}
func (m *MsgDeployFungibleCoinZRC20Response) XXX_Size() int {
return m.Size()
}
func (m *MsgDeployFungibleCoinZRC20Response) XXX_DiscardUnknown() {
xxx_messageInfo_MsgDeployFungibleCoinZRC20Response.DiscardUnknown(m)
}
var xxx_messageInfo_MsgDeployFungibleCoinZRC20Response proto.InternalMessageInfo
func (m *MsgDeployFungibleCoinZRC20Response) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
type MsgRemoveForeignCoin struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
}
func (m *MsgRemoveForeignCoin) Reset() { *m = MsgRemoveForeignCoin{} }
func (m *MsgRemoveForeignCoin) String() string { return proto.CompactTextString(m) }
func (*MsgRemoveForeignCoin) ProtoMessage() {}
func (*MsgRemoveForeignCoin) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{6}
}
func (m *MsgRemoveForeignCoin) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgRemoveForeignCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgRemoveForeignCoin.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgRemoveForeignCoin) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgRemoveForeignCoin.Merge(m, src)
}
func (m *MsgRemoveForeignCoin) XXX_Size() int {
return m.Size()
}
func (m *MsgRemoveForeignCoin) XXX_DiscardUnknown() {
xxx_messageInfo_MsgRemoveForeignCoin.DiscardUnknown(m)
}
var xxx_messageInfo_MsgRemoveForeignCoin proto.InternalMessageInfo
func (m *MsgRemoveForeignCoin) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgRemoveForeignCoin) GetName() string {
if m != nil {
return m.Name
}
return ""
}
type MsgRemoveForeignCoinResponse struct {
}
func (m *MsgRemoveForeignCoinResponse) Reset() { *m = MsgRemoveForeignCoinResponse{} }
func (m *MsgRemoveForeignCoinResponse) String() string { return proto.CompactTextString(m) }
func (*MsgRemoveForeignCoinResponse) ProtoMessage() {}
func (*MsgRemoveForeignCoinResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{7}
}
func (m *MsgRemoveForeignCoinResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgRemoveForeignCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgRemoveForeignCoinResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgRemoveForeignCoinResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgRemoveForeignCoinResponse.Merge(m, src)
}
func (m *MsgRemoveForeignCoinResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgRemoveForeignCoinResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgRemoveForeignCoinResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgRemoveForeignCoinResponse proto.InternalMessageInfo
type MsgUpdateContractBytecode struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"`
NewBytecodeAddress string `protobuf:"bytes,3,opt,name=new_bytecode_address,json=newBytecodeAddress,proto3" json:"new_bytecode_address,omitempty"`
}
func (m *MsgUpdateContractBytecode) Reset() { *m = MsgUpdateContractBytecode{} }
func (m *MsgUpdateContractBytecode) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateContractBytecode) ProtoMessage() {}
func (*MsgUpdateContractBytecode) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{8}
}
func (m *MsgUpdateContractBytecode) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateContractBytecode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateContractBytecode.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateContractBytecode) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateContractBytecode.Merge(m, src)
}
func (m *MsgUpdateContractBytecode) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateContractBytecode) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateContractBytecode.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateContractBytecode proto.InternalMessageInfo
func (m *MsgUpdateContractBytecode) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateContractBytecode) GetContractAddress() string {
if m != nil {
return m.ContractAddress
}
return ""
}
func (m *MsgUpdateContractBytecode) GetNewBytecodeAddress() string {
if m != nil {
return m.NewBytecodeAddress
}
return ""
}
type MsgUpdateContractBytecodeResponse struct {
NewBytecodeHash []byte `protobuf:"bytes,1,opt,name=new_bytecode_hash,json=newBytecodeHash,proto3" json:"new_bytecode_hash,omitempty"`
}
func (m *MsgUpdateContractBytecodeResponse) Reset() { *m = MsgUpdateContractBytecodeResponse{} }
func (m *MsgUpdateContractBytecodeResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateContractBytecodeResponse) ProtoMessage() {}
func (*MsgUpdateContractBytecodeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{9}
}
func (m *MsgUpdateContractBytecodeResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateContractBytecodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateContractBytecodeResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateContractBytecodeResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateContractBytecodeResponse.Merge(m, src)
}
func (m *MsgUpdateContractBytecodeResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateContractBytecodeResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateContractBytecodeResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateContractBytecodeResponse proto.InternalMessageInfo
func (m *MsgUpdateContractBytecodeResponse) GetNewBytecodeHash() []byte {
if m != nil {
return m.NewBytecodeHash
}
return nil
}
type MsgUpdateZRC20PausedStatus struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Zrc20Addresses []string `protobuf:"bytes,2,rep,name=zrc20_addresses,json=zrc20Addresses,proto3" json:"zrc20_addresses,omitempty"`
Action UpdatePausedStatusAction `protobuf:"varint,3,opt,name=action,proto3,enum=zetachain.zetacore.fungible.UpdatePausedStatusAction" json:"action,omitempty"`
}
func (m *MsgUpdateZRC20PausedStatus) Reset() { *m = MsgUpdateZRC20PausedStatus{} }
func (m *MsgUpdateZRC20PausedStatus) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateZRC20PausedStatus) ProtoMessage() {}
func (*MsgUpdateZRC20PausedStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{10}
}
func (m *MsgUpdateZRC20PausedStatus) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateZRC20PausedStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateZRC20PausedStatus.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateZRC20PausedStatus) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateZRC20PausedStatus.Merge(m, src)
}
func (m *MsgUpdateZRC20PausedStatus) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateZRC20PausedStatus) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateZRC20PausedStatus.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateZRC20PausedStatus proto.InternalMessageInfo
func (m *MsgUpdateZRC20PausedStatus) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateZRC20PausedStatus) GetZrc20Addresses() []string {
if m != nil {
return m.Zrc20Addresses
}
return nil
}
func (m *MsgUpdateZRC20PausedStatus) GetAction() UpdatePausedStatusAction {
if m != nil {
return m.Action
}
return UpdatePausedStatusAction_PAUSE
}
type MsgUpdateZRC20PausedStatusResponse struct {
}
func (m *MsgUpdateZRC20PausedStatusResponse) Reset() { *m = MsgUpdateZRC20PausedStatusResponse{} }
func (m *MsgUpdateZRC20PausedStatusResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateZRC20PausedStatusResponse) ProtoMessage() {}
func (*MsgUpdateZRC20PausedStatusResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{11}
}
func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse.Merge(m, src)
}
func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateZRC20PausedStatusResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse proto.InternalMessageInfo
type MsgUpdateZRC20LiquidityCap struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Zrc20Address string `protobuf:"bytes,2,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"`
LiquidityCap github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,3,opt,name=liquidity_cap,json=liquidityCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"liquidity_cap"`
}
func (m *MsgUpdateZRC20LiquidityCap) Reset() { *m = MsgUpdateZRC20LiquidityCap{} }
func (m *MsgUpdateZRC20LiquidityCap) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateZRC20LiquidityCap) ProtoMessage() {}
func (*MsgUpdateZRC20LiquidityCap) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{12}
}
func (m *MsgUpdateZRC20LiquidityCap) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateZRC20LiquidityCap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateZRC20LiquidityCap.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateZRC20LiquidityCap) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateZRC20LiquidityCap.Merge(m, src)
}
func (m *MsgUpdateZRC20LiquidityCap) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateZRC20LiquidityCap) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateZRC20LiquidityCap.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateZRC20LiquidityCap proto.InternalMessageInfo
func (m *MsgUpdateZRC20LiquidityCap) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateZRC20LiquidityCap) GetZrc20Address() string {
if m != nil {
return m.Zrc20Address
}
return ""
}
type MsgUpdateZRC20LiquidityCapResponse struct {
}
func (m *MsgUpdateZRC20LiquidityCapResponse) Reset() { *m = MsgUpdateZRC20LiquidityCapResponse{} }
func (m *MsgUpdateZRC20LiquidityCapResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateZRC20LiquidityCapResponse) ProtoMessage() {}
func (*MsgUpdateZRC20LiquidityCapResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_197fdedece277fa0, []int{13}
}
func (m *MsgUpdateZRC20LiquidityCapResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateZRC20LiquidityCapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateZRC20LiquidityCapResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateZRC20LiquidityCapResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateZRC20LiquidityCapResponse.Merge(m, src)
}
func (m *MsgUpdateZRC20LiquidityCapResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateZRC20LiquidityCapResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateZRC20LiquidityCapResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateZRC20LiquidityCapResponse proto.InternalMessageInfo
func init() {
proto.RegisterEnum("zetachain.zetacore.fungible.UpdatePausedStatusAction", UpdatePausedStatusAction_name, UpdatePausedStatusAction_value)
proto.RegisterType((*MsgUpdateZRC20WithdrawFee)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFee")
proto.RegisterType((*MsgUpdateZRC20WithdrawFeeResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFeeResponse")
proto.RegisterType((*MsgUpdateSystemContract)(nil), "zetachain.zetacore.fungible.MsgUpdateSystemContract")
proto.RegisterType((*MsgUpdateSystemContractResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateSystemContractResponse")
proto.RegisterType((*MsgDeployFungibleCoinZRC20)(nil), "zetachain.zetacore.fungible.MsgDeployFungibleCoinZRC20")
proto.RegisterType((*MsgDeployFungibleCoinZRC20Response)(nil), "zetachain.zetacore.fungible.MsgDeployFungibleCoinZRC20Response")
proto.RegisterType((*MsgRemoveForeignCoin)(nil), "zetachain.zetacore.fungible.MsgRemoveForeignCoin")
proto.RegisterType((*MsgRemoveForeignCoinResponse)(nil), "zetachain.zetacore.fungible.MsgRemoveForeignCoinResponse")
proto.RegisterType((*MsgUpdateContractBytecode)(nil), "zetachain.zetacore.fungible.MsgUpdateContractBytecode")
proto.RegisterType((*MsgUpdateContractBytecodeResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateContractBytecodeResponse")
proto.RegisterType((*MsgUpdateZRC20PausedStatus)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20PausedStatus")
proto.RegisterType((*MsgUpdateZRC20PausedStatusResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20PausedStatusResponse")
proto.RegisterType((*MsgUpdateZRC20LiquidityCap)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20LiquidityCap")
proto.RegisterType((*MsgUpdateZRC20LiquidityCapResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20LiquidityCapResponse")
}
func init() { proto.RegisterFile("fungible/tx.proto", fileDescriptor_197fdedece277fa0) }
var fileDescriptor_197fdedece277fa0 = []byte{
// 913 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcb, 0x6e, 0xdb, 0x46,
0x14, 0x15, 0xad, 0xf8, 0xa1, 0x1b, 0x5b, 0x96, 0x59, 0x21, 0x61, 0xe5, 0x42, 0x76, 0x98, 0x02,
0x51, 0x03, 0x58, 0x74, 0xd5, 0x47, 0x50, 0xa0, 0x4d, 0x61, 0x2b, 0x71, 0x1b, 0x20, 0x6a, 0x03,
0x3a, 0x46, 0xd1, 0x6c, 0x88, 0x11, 0x39, 0xa6, 0x06, 0x15, 0x67, 0x54, 0xce, 0xa8, 0x8a, 0xb2,
0xeb, 0xd6, 0xab, 0xa0, 0xfd, 0x8f, 0x02, 0xfd, 0x8b, 0x2c, 0xb3, 0x2c, 0xba, 0x08, 0x0a, 0xfb,
0x3f, 0x8a, 0x82, 0xc3, 0x87, 0xa9, 0x07, 0x65, 0x4b, 0x5d, 0x69, 0x66, 0x74, 0xef, 0xe1, 0xb9,
0xf7, 0x9e, 0x39, 0x24, 0x6c, 0x9d, 0xf6, 0xa9, 0x4b, 0xda, 0x5d, 0x6c, 0x88, 0x97, 0xf5, 0x9e,
0xcf, 0x04, 0x53, 0xb7, 0x5f, 0x61, 0x81, 0xec, 0x0e, 0x22, 0xb4, 0x2e, 0x57, 0xcc, 0xc7, 0xf5,
0x38, 0xaa, 0xf2, 0x9e, 0xcd, 0x3c, 0x8f, 0x51, 0x23, 0xfc, 0x09, 0x33, 0x2a, 0x65, 0x97, 0xb9,
0x4c, 0x2e, 0x8d, 0x60, 0x15, 0x9e, 0xea, 0x67, 0x4b, 0xf0, 0x7e, 0x8b, 0xbb, 0x27, 0x3d, 0x07,
0x09, 0xfc, 0xc2, 0x6c, 0x36, 0xf6, 0x7f, 0x20, 0xa2, 0xe3, 0xf8, 0x68, 0x70, 0x84, 0xb1, 0xaa,
0xc1, 0xaa, 0xed, 0x63, 0x24, 0x98, 0xaf, 0x29, 0xbb, 0x4a, 0xad, 0x60, 0xc6, 0x5b, 0xf5, 0x2e,
0x6c, 0xbc, 0xf2, 0xed, 0xc6, 0xbe, 0x85, 0x1c, 0xc7, 0xc7, 0x9c, 0x6b, 0x4b, 0xf2, 0xff, 0x75,
0x79, 0x78, 0x10, 0x9e, 0xa9, 0x3f, 0x42, 0x89, 0xe2, 0x81, 0x35, 0x88, 0x10, 0xad, 0x53, 0x8c,
0xb5, 0x95, 0x20, 0xee, 0xd0, 0x78, 0xf3, 0x6e, 0x27, 0xf7, 0xf7, 0xbb, 0x9d, 0x7b, 0x2e, 0x11,
0x9d, 0x7e, 0xbb, 0x6e, 0x33, 0xcf, 0xb0, 0x19, 0xf7, 0x18, 0x8f, 0x7e, 0xf6, 0xb8, 0xf3, 0x93,
0x21, 0x86, 0x3d, 0xcc, 0xeb, 0x27, 0x84, 0x0a, 0xb3, 0x48, 0xf1, 0x20, 0xcd, 0xec, 0x18, 0x36,
0x02, 0x68, 0x17, 0x71, 0xab, 0x4b, 0x3c, 0x22, 0xb4, 0xd5, 0xc5, 0x70, 0x6f, 0x52, 0x3c, 0xf8,
0x06, 0xf1, 0xa7, 0x01, 0x86, 0x7e, 0x17, 0xee, 0x64, 0xf6, 0xc2, 0xc4, 0xbc, 0xc7, 0x28, 0xc7,
0xba, 0x0f, 0xb7, 0x93, 0xa0, 0xe3, 0x21, 0x17, 0xd8, 0x6b, 0x32, 0x2a, 0x7c, 0x64, 0x8b, 0x19,
0xed, 0xfa, 0x0a, 0xb6, 0x03, 0xba, 0x5c, 0xc6, 0x5b, 0x76, 0x94, 0x30, 0xd6, 0x3c, 0x8d, 0xe2,
0xc1, 0x28, 0x62, 0xd4, 0x48, 0xfd, 0x0e, 0xec, 0x64, 0x3c, 0x33, 0xa1, 0x75, 0xb6, 0x04, 0x95,
0x16, 0x77, 0x1f, 0xe1, 0x5e, 0x97, 0x0d, 0x8f, 0x22, 0x25, 0x34, 0x19, 0xa1, 0xb2, 0x90, 0x19,
0xd4, 0xca, 0xb0, 0xfc, 0x38, 0x08, 0x89, 0x48, 0x84, 0x1b, 0xb5, 0x06, 0xa5, 0x53, 0xe6, 0x63,
0xe2, 0x52, 0x4b, 0xaa, 0xcc, 0x22, 0x8e, 0x96, 0xdf, 0x55, 0x6a, 0x79, 0xb3, 0x18, 0x9d, 0x37,
0x83, 0xe3, 0x27, 0x8e, 0x5a, 0x81, 0x35, 0x07, 0xdb, 0xc4, 0x43, 0x5d, 0xae, 0xdd, 0xd8, 0x55,
0x6a, 0x1b, 0x66, 0xb2, 0x57, 0x55, 0xb8, 0x41, 0x91, 0x87, 0xb5, 0x65, 0x09, 0x2d, 0xd7, 0xea,
0x2d, 0x58, 0xe1, 0x43, 0xaf, 0xcd, 0xba, 0xa1, 0x14, 0xcc, 0x68, 0xa7, 0xee, 0x41, 0xc1, 0x66,
0x84, 0x5a, 0xc1, 0x70, 0xe4, 0x34, 0x8b, 0x8d, 0x52, 0x3d, 0x52, 0x70, 0x50, 0xc7, 0xf3, 0x61,
0x0f, 0x9b, 0x6b, 0x76, 0xb4, 0x52, 0xb7, 0xa1, 0x70, 0x39, 0xfc, 0x35, 0xc9, 0x6c, 0xcd, 0x8d,
0x07, 0xf9, 0x10, 0xf4, 0xec, 0x5e, 0xc4, 0x2d, 0x0b, 0x7a, 0x12, 0x0f, 0x20, 0xea, 0x49, 0xb4,
0xd5, 0x1f, 0x41, 0xb9, 0xc5, 0x5d, 0x13, 0x7b, 0xec, 0x17, 0x7c, 0x14, 0x95, 0xcb, 0x08, 0x9d,
0xd1, 0xc5, 0xb8, 0xd2, 0xa5, 0xcb, 0x4a, 0xf5, 0x2a, 0x7c, 0x30, 0x0d, 0x25, 0x19, 0xd9, 0x6f,
0x4a, 0xea, 0xee, 0xc5, 0x03, 0x3d, 0x1c, 0x0a, 0x6c, 0x33, 0x67, 0xd6, 0xdd, 0xfb, 0x08, 0x4a,
0x19, 0x0a, 0xda, 0xb4, 0x47, 0x85, 0xa3, 0xee, 0x43, 0x39, 0xd0, 0x5d, 0x3b, 0x02, 0x4d, 0xc2,
0xf3, 0x32, 0x5c, 0xa5, 0x78, 0x10, 0x3f, 0x2f, 0x96, 0xda, 0xf7, 0xa9, 0x3b, 0x30, 0xce, 0x29,
0xe9, 0xdc, 0x7d, 0xd8, 0x1a, 0x81, 0xed, 0x20, 0xde, 0x91, 0x2c, 0xd7, 0xcd, 0xcd, 0x14, 0xe6,
0xb7, 0x88, 0x77, 0xf4, 0x3f, 0x14, 0x29, 0xcc, 0xd4, 0xad, 0x7a, 0x86, 0xfa, 0x1c, 0x3b, 0xc7,
0x02, 0x89, 0x3e, 0x9f, 0x51, 0xe6, 0x3d, 0xd8, 0x1c, 0xb1, 0x18, 0x1c, 0x54, 0x99, 0xaf, 0x15,
0xcc, 0x62, 0xda, 0x64, 0x30, 0x57, 0x5b, 0xb0, 0x82, 0x6c, 0x41, 0x18, 0x95, 0x65, 0x15, 0x1b,
0x9f, 0xd5, 0x67, 0x98, 0x63, 0x3d, 0x24, 0x92, 0xe6, 0x70, 0x20, 0x93, 0xcd, 0x08, 0x44, 0xff,
0x50, 0x8a, 0x27, 0x83, 0x6f, 0x32, 0xbc, 0x3f, 0x27, 0xca, 0x7a, 0x4a, 0x7e, 0xee, 0x13, 0x87,
0x88, 0x61, 0x13, 0xf5, 0xfe, 0xaf, 0x73, 0x3e, 0x87, 0x8d, 0x6e, 0x0c, 0x67, 0xd9, 0xa8, 0x17,
0x0e, 0x6c, 0x7e, 0x7b, 0x5b, 0xef, 0xa6, 0x48, 0x4d, 0x56, 0x96, 0xa6, 0x1c, 0x57, 0x76, 0xbf,
0x01, 0x5a, 0x56, 0x8f, 0xd4, 0x02, 0x2c, 0x3f, 0x3b, 0x38, 0x39, 0x7e, 0x5c, 0xca, 0xa9, 0x37,
0x61, 0xf5, 0xe4, 0xbb, 0x70, 0xa3, 0x34, 0xfe, 0x5d, 0x85, 0x7c, 0x8b, 0xbb, 0xea, 0xef, 0x0a,
0xdc, 0xce, 0xb2, 0xa0, 0x07, 0x33, 0xc7, 0x92, 0x7d, 0x5f, 0x2b, 0x5f, 0x2f, 0x98, 0x98, 0xc8,
0xf5, 0x57, 0x05, 0xb6, 0x26, 0x2f, 0xf3, 0xc7, 0x57, 0xc1, 0x4e, 0xa4, 0x54, 0xbe, 0x98, 0x3b,
0x25, 0xe1, 0x70, 0xa6, 0x40, 0x79, 0xea, 0x4b, 0xe3, 0xd3, 0xab, 0x30, 0xa7, 0x65, 0x55, 0xbe,
0x5c, 0x24, 0x2b, 0x21, 0xf3, 0x5a, 0x81, 0x5b, 0x19, 0xb6, 0xf3, 0xf9, 0xf5, 0x80, 0xc7, 0xf3,
0x2a, 0x0f, 0x17, 0xcb, 0x9b, 0x42, 0x69, 0xe2, 0x2b, 0xe4, 0x9a, 0x94, 0xc6, 0xf3, 0xae, 0x4b,
0x29, 0xeb, 0x4d, 0x2f, 0xc5, 0x9c, 0x65, 0x5b, 0x0f, 0xe6, 0xc0, 0x4e, 0x27, 0x5e, 0x2d, 0xe6,
0x2b, 0x8c, 0x67, 0x9c, 0xd5, 0x88, 0xeb, 0xcc, 0xc3, 0x2a, 0x9d, 0x38, 0x17, 0xab, 0x69, 0xa6,
0x71, 0xf8, 0xe4, 0xcd, 0x79, 0x55, 0x79, 0x7b, 0x5e, 0x55, 0xfe, 0x39, 0xaf, 0x2a, 0xaf, 0x2f,
0xaa, 0xb9, 0xb7, 0x17, 0xd5, 0xdc, 0x5f, 0x17, 0xd5, 0xdc, 0x0b, 0x23, 0xe5, 0x55, 0x01, 0xf4,
0x9e, 0x7c, 0x8a, 0x11, 0x3f, 0xc5, 0x78, 0x69, 0x5c, 0x7e, 0xdd, 0x06, 0xc6, 0xd5, 0x5e, 0x91,
0x5f, 0xa6, 0x9f, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0x42, 0x83, 0xe6, 0x96, 0xf6, 0x0a, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MsgClient interface {
DeployFungibleCoinZRC20(ctx context.Context, in *MsgDeployFungibleCoinZRC20, opts ...grpc.CallOption) (*MsgDeployFungibleCoinZRC20Response, error)
RemoveForeignCoin(ctx context.Context, in *MsgRemoveForeignCoin, opts ...grpc.CallOption) (*MsgRemoveForeignCoinResponse, error)
UpdateSystemContract(ctx context.Context, in *MsgUpdateSystemContract, opts ...grpc.CallOption) (*MsgUpdateSystemContractResponse, error)
UpdateContractBytecode(ctx context.Context, in *MsgUpdateContractBytecode, opts ...grpc.CallOption) (*MsgUpdateContractBytecodeResponse, error)
UpdateZRC20WithdrawFee(ctx context.Context, in *MsgUpdateZRC20WithdrawFee, opts ...grpc.CallOption) (*MsgUpdateZRC20WithdrawFeeResponse, error)
UpdateZRC20PausedStatus(ctx context.Context, in *MsgUpdateZRC20PausedStatus, opts ...grpc.CallOption) (*MsgUpdateZRC20PausedStatusResponse, error)
UpdateZRC20LiquidityCap(ctx context.Context, in *MsgUpdateZRC20LiquidityCap, opts ...grpc.CallOption) (*MsgUpdateZRC20LiquidityCapResponse, error)
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) DeployFungibleCoinZRC20(ctx context.Context, in *MsgDeployFungibleCoinZRC20, opts ...grpc.CallOption) (*MsgDeployFungibleCoinZRC20Response, error) {
out := new(MsgDeployFungibleCoinZRC20Response)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/DeployFungibleCoinZRC20", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RemoveForeignCoin(ctx context.Context, in *MsgRemoveForeignCoin, opts ...grpc.CallOption) (*MsgRemoveForeignCoinResponse, error) {
out := new(MsgRemoveForeignCoinResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/RemoveForeignCoin", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateSystemContract(ctx context.Context, in *MsgUpdateSystemContract, opts ...grpc.CallOption) (*MsgUpdateSystemContractResponse, error) {
out := new(MsgUpdateSystemContractResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateSystemContract", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateContractBytecode(ctx context.Context, in *MsgUpdateContractBytecode, opts ...grpc.CallOption) (*MsgUpdateContractBytecodeResponse, error) {
out := new(MsgUpdateContractBytecodeResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateContractBytecode", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateZRC20WithdrawFee(ctx context.Context, in *MsgUpdateZRC20WithdrawFee, opts ...grpc.CallOption) (*MsgUpdateZRC20WithdrawFeeResponse, error) {
out := new(MsgUpdateZRC20WithdrawFeeResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateZRC20WithdrawFee", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateZRC20PausedStatus(ctx context.Context, in *MsgUpdateZRC20PausedStatus, opts ...grpc.CallOption) (*MsgUpdateZRC20PausedStatusResponse, error) {
out := new(MsgUpdateZRC20PausedStatusResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateZRC20PausedStatus", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateZRC20LiquidityCap(ctx context.Context, in *MsgUpdateZRC20LiquidityCap, opts ...grpc.CallOption) (*MsgUpdateZRC20LiquidityCapResponse, error) {
out := new(MsgUpdateZRC20LiquidityCapResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateZRC20LiquidityCap", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
DeployFungibleCoinZRC20(context.Context, *MsgDeployFungibleCoinZRC20) (*MsgDeployFungibleCoinZRC20Response, error)
RemoveForeignCoin(context.Context, *MsgRemoveForeignCoin) (*MsgRemoveForeignCoinResponse, error)
UpdateSystemContract(context.Context, *MsgUpdateSystemContract) (*MsgUpdateSystemContractResponse, error)
UpdateContractBytecode(context.Context, *MsgUpdateContractBytecode) (*MsgUpdateContractBytecodeResponse, error)
UpdateZRC20WithdrawFee(context.Context, *MsgUpdateZRC20WithdrawFee) (*MsgUpdateZRC20WithdrawFeeResponse, error)
UpdateZRC20PausedStatus(context.Context, *MsgUpdateZRC20PausedStatus) (*MsgUpdateZRC20PausedStatusResponse, error)
UpdateZRC20LiquidityCap(context.Context, *MsgUpdateZRC20LiquidityCap) (*MsgUpdateZRC20LiquidityCapResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) DeployFungibleCoinZRC20(ctx context.Context, req *MsgDeployFungibleCoinZRC20) (*MsgDeployFungibleCoinZRC20Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeployFungibleCoinZRC20 not implemented")
}
func (*UnimplementedMsgServer) RemoveForeignCoin(ctx context.Context, req *MsgRemoveForeignCoin) (*MsgRemoveForeignCoinResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RemoveForeignCoin not implemented")
}
func (*UnimplementedMsgServer) UpdateSystemContract(ctx context.Context, req *MsgUpdateSystemContract) (*MsgUpdateSystemContractResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateSystemContract not implemented")
}
func (*UnimplementedMsgServer) UpdateContractBytecode(ctx context.Context, req *MsgUpdateContractBytecode) (*MsgUpdateContractBytecodeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateContractBytecode not implemented")
}
func (*UnimplementedMsgServer) UpdateZRC20WithdrawFee(ctx context.Context, req *MsgUpdateZRC20WithdrawFee) (*MsgUpdateZRC20WithdrawFeeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateZRC20WithdrawFee not implemented")
}
func (*UnimplementedMsgServer) UpdateZRC20PausedStatus(ctx context.Context, req *MsgUpdateZRC20PausedStatus) (*MsgUpdateZRC20PausedStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateZRC20PausedStatus not implemented")
}
func (*UnimplementedMsgServer) UpdateZRC20LiquidityCap(ctx context.Context, req *MsgUpdateZRC20LiquidityCap) (*MsgUpdateZRC20LiquidityCapResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateZRC20LiquidityCap not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
func _Msg_DeployFungibleCoinZRC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgDeployFungibleCoinZRC20)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).DeployFungibleCoinZRC20(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Msg/DeployFungibleCoinZRC20",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).DeployFungibleCoinZRC20(ctx, req.(*MsgDeployFungibleCoinZRC20))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RemoveForeignCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRemoveForeignCoin)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RemoveForeignCoin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Msg/RemoveForeignCoin",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RemoveForeignCoin(ctx, req.(*MsgRemoveForeignCoin))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateSystemContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateSystemContract)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateSystemContract(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateSystemContract",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateSystemContract(ctx, req.(*MsgUpdateSystemContract))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateContractBytecode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateContractBytecode)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateContractBytecode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateContractBytecode",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateContractBytecode(ctx, req.(*MsgUpdateContractBytecode))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateZRC20WithdrawFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateZRC20WithdrawFee)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateZRC20WithdrawFee(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateZRC20WithdrawFee",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateZRC20WithdrawFee(ctx, req.(*MsgUpdateZRC20WithdrawFee))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateZRC20PausedStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateZRC20PausedStatus)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateZRC20PausedStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateZRC20PausedStatus",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateZRC20PausedStatus(ctx, req.(*MsgUpdateZRC20PausedStatus))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateZRC20LiquidityCap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateZRC20LiquidityCap)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateZRC20LiquidityCap(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateZRC20LiquidityCap",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateZRC20LiquidityCap(ctx, req.(*MsgUpdateZRC20LiquidityCap))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.fungible.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "DeployFungibleCoinZRC20",
Handler: _Msg_DeployFungibleCoinZRC20_Handler,
},
{
MethodName: "RemoveForeignCoin",
Handler: _Msg_RemoveForeignCoin_Handler,
},
{
MethodName: "UpdateSystemContract",
Handler: _Msg_UpdateSystemContract_Handler,
},
{
MethodName: "UpdateContractBytecode",
Handler: _Msg_UpdateContractBytecode_Handler,
},
{
MethodName: "UpdateZRC20WithdrawFee",
Handler: _Msg_UpdateZRC20WithdrawFee_Handler,
},
{
MethodName: "UpdateZRC20PausedStatus",
Handler: _Msg_UpdateZRC20PausedStatus_Handler,
},
{
MethodName: "UpdateZRC20LiquidityCap",
Handler: _Msg_UpdateZRC20LiquidityCap_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "fungible/tx.proto",
}
func (m *MsgUpdateZRC20WithdrawFee) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateZRC20WithdrawFee) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateZRC20WithdrawFee) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.NewGasLimit.Size()
i -= size
if _, err := m.NewGasLimit.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
{
size := m.NewWithdrawFee.Size()
i -= size
if _, err := m.NewWithdrawFee.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if len(m.Zrc20Address) > 0 {
i -= len(m.Zrc20Address)
copy(dAtA[i:], m.Zrc20Address)
i = encodeVarintTx(dAtA, i, uint64(len(m.Zrc20Address)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgUpdateSystemContract) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateSystemContract) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateSystemContract) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NewSystemContractAddress) > 0 {
i -= len(m.NewSystemContractAddress)
copy(dAtA[i:], m.NewSystemContractAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.NewSystemContractAddress)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateSystemContractResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateSystemContractResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateSystemContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgDeployFungibleCoinZRC20) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgDeployFungibleCoinZRC20) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgDeployFungibleCoinZRC20) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.GasLimit != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.GasLimit))
i--
dAtA[i] = 0x40
}
if m.CoinType != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.CoinType))
i--
dAtA[i] = 0x38
}
if len(m.Symbol) > 0 {
i -= len(m.Symbol)
copy(dAtA[i:], m.Symbol)
i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol)))
i--
dAtA[i] = 0x32
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintTx(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x2a
}
if m.Decimals != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Decimals))
i--
dAtA[i] = 0x20
}
if m.ForeignChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ForeignChainId))
i--
dAtA[i] = 0x18
}
if len(m.ERC20) > 0 {
i -= len(m.ERC20)
copy(dAtA[i:], m.ERC20)
i = encodeVarintTx(dAtA, i, uint64(len(m.ERC20)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgDeployFungibleCoinZRC20Response) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgDeployFungibleCoinZRC20Response) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgDeployFungibleCoinZRC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintTx(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgRemoveForeignCoin) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgRemoveForeignCoin) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgRemoveForeignCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintTx(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgRemoveForeignCoinResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgRemoveForeignCoinResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgRemoveForeignCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgUpdateContractBytecode) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateContractBytecode) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateContractBytecode) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NewBytecodeAddress) > 0 {
i -= len(m.NewBytecodeAddress)
copy(dAtA[i:], m.NewBytecodeAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.NewBytecodeAddress)))
i--
dAtA[i] = 0x1a
}
if len(m.ContractAddress) > 0 {
i -= len(m.ContractAddress)
copy(dAtA[i:], m.ContractAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateContractBytecodeResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateContractBytecodeResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateContractBytecodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.NewBytecodeHash) > 0 {
i -= len(m.NewBytecodeHash)
copy(dAtA[i:], m.NewBytecodeHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.NewBytecodeHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateZRC20PausedStatus) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateZRC20PausedStatus) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateZRC20PausedStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Action != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Action))
i--
dAtA[i] = 0x18
}
if len(m.Zrc20Addresses) > 0 {
for iNdEx := len(m.Zrc20Addresses) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Zrc20Addresses[iNdEx])
copy(dAtA[i:], m.Zrc20Addresses[iNdEx])
i = encodeVarintTx(dAtA, i, uint64(len(m.Zrc20Addresses[iNdEx])))
i--
dAtA[i] = 0x12
}
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateZRC20PausedStatusResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateZRC20PausedStatusResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateZRC20PausedStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgUpdateZRC20LiquidityCap) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateZRC20LiquidityCap) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateZRC20LiquidityCap) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.LiquidityCap.Size()
i -= size
if _, err := m.LiquidityCap.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if len(m.Zrc20Address) > 0 {
i -= len(m.Zrc20Address)
copy(dAtA[i:], m.Zrc20Address)
i = encodeVarintTx(dAtA, i, uint64(len(m.Zrc20Address)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateZRC20LiquidityCapResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateZRC20LiquidityCapResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateZRC20LiquidityCapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *MsgUpdateZRC20WithdrawFee) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Zrc20Address)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.NewWithdrawFee.Size()
n += 1 + l + sovTx(uint64(l))
l = m.NewGasLimit.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgUpdateSystemContract) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.NewSystemContractAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateSystemContractResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgDeployFungibleCoinZRC20) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.ERC20)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ForeignChainId != 0 {
n += 1 + sovTx(uint64(m.ForeignChainId))
}
if m.Decimals != 0 {
n += 1 + sovTx(uint64(m.Decimals))
}
l = len(m.Name)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Symbol)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.CoinType != 0 {
n += 1 + sovTx(uint64(m.CoinType))
}
if m.GasLimit != 0 {
n += 1 + sovTx(uint64(m.GasLimit))
}
return n
}
func (m *MsgDeployFungibleCoinZRC20Response) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgRemoveForeignCoin) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Name)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgRemoveForeignCoinResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgUpdateContractBytecode) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.ContractAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.NewBytecodeAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateContractBytecodeResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.NewBytecodeHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateZRC20PausedStatus) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if len(m.Zrc20Addresses) > 0 {
for _, s := range m.Zrc20Addresses {
l = len(s)
n += 1 + l + sovTx(uint64(l))
}
}
if m.Action != 0 {
n += 1 + sovTx(uint64(m.Action))
}
return n
}
func (m *MsgUpdateZRC20PausedStatusResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgUpdateZRC20LiquidityCap) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Zrc20Address)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.LiquidityCap.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateZRC20LiquidityCapResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgUpdateZRC20WithdrawFee) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFee: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFee: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Zrc20Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewWithdrawFee", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.NewWithdrawFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewGasLimit", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.NewGasLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateZRC20WithdrawFeeResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFeeResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFeeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateSystemContract) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateSystemContract: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateSystemContract: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewSystemContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewSystemContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateSystemContractResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateSystemContractResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateSystemContractResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgDeployFungibleCoinZRC20) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgDeployFungibleCoinZRC20: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgDeployFungibleCoinZRC20: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ERC20", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ERC20 = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ForeignChainId", wireType)
}
m.ForeignChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ForeignChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType)
}
m.Decimals = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Decimals |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Symbol = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType)
}
m.CoinType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CoinType |= common.CoinType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType)
}
m.GasLimit = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasLimit |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgDeployFungibleCoinZRC20Response) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgDeployFungibleCoinZRC20Response: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgDeployFungibleCoinZRC20Response: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgRemoveForeignCoin) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgRemoveForeignCoin: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgRemoveForeignCoin: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgRemoveForeignCoinResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgRemoveForeignCoinResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgRemoveForeignCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateContractBytecode) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateContractBytecode: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateContractBytecode: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewBytecodeAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewBytecodeAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateContractBytecodeResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateContractBytecodeResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateContractBytecodeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewBytecodeHash", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewBytecodeHash = append(m.NewBytecodeHash[:0], dAtA[iNdEx:postIndex]...)
if m.NewBytecodeHash == nil {
m.NewBytecodeHash = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateZRC20PausedStatus) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateZRC20PausedStatus: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateZRC20PausedStatus: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Addresses", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Zrc20Addresses = append(m.Zrc20Addresses, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType)
}
m.Action = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Action |= UpdatePausedStatusAction(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateZRC20PausedStatusResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateZRC20PausedStatusResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateZRC20PausedStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateZRC20LiquidityCap) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateZRC20LiquidityCap: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateZRC20LiquidityCap: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Zrc20Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LiquidityCap", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.LiquidityCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateZRC20LiquidityCapResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateZRC20LiquidityCapResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateZRC20LiquidityCapResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
package types
import ethcommon "github.com/ethereum/go-ethereum/common"
// ZRC20Data represents the ZRC4 token details used to map
// the token to a Cosmos Coin
type ZRC20Data struct {
Name string
Symbol string
Decimals uint8
}
// ZRC20StringResponse defines the string value from the call response
type ZRC20StringResponse struct {
Value string
}
// ZRC20Uint8Response defines the uint8 value from the call response
type ZRC20Uint8Response struct {
Value uint8
}
// ZRC20BoolResponse defines the bool value from the call response
type ZRC20BoolResponse struct {
Value bool
}
// UniswapV2FactoryByte32Response defines the string value from the call response
type UniswapV2FactoryByte32Response struct {
Value [32]byte
}
// SystemAddressResponse defines the address value from the call response
type SystemAddressResponse struct {
Value ethcommon.Address
}
// NewZRC20Data creates a new ZRC20Data instance
func NewZRC20Data(name, symbol string, decimals uint8) ZRC20Data {
return ZRC20Data{
Name: name,
Symbol: symbol,
Decimals: decimals,
}
}
package observer
import (
"math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/keeper"
"github.com/zeta-chain/zetacore/x/observer/types"
)
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
lastBlockObserverCount, found := k.GetLastObserverCount(ctx)
if !found {
ctx.Logger().Error("LastBlockObserverCount not found at height", ctx.BlockHeight())
return
}
allObservers := k.GetAllObserverMappers(ctx)
totalObserverCountCurrentBlock := 0
for _, observer := range allObservers {
totalObserverCountCurrentBlock += len(observer.ObserverList)
}
if totalObserverCountCurrentBlock < 0 {
ctx.Logger().Error("TotalObserverCount is negative at height", ctx.BlockHeight())
return
}
// #nosec G701 always in range
if totalObserverCountCurrentBlock == int(lastBlockObserverCount.Count) {
return
}
ctx.Logger().Error("LastBlockObserverCount does not match the number of observers found at current height", ctx.BlockHeight())
for _, observer := range allObservers {
ctx.Logger().Error("Observes for | ", observer.ObserverChain.ChainName, ":", observer.ObserverList)
}
k.DisableInboundOnly(ctx)
k.SetKeygen(ctx, types.Keygen{BlockNumber: math.MaxInt64})
// #nosec G701 always positive
k.SetLastObserverCount(ctx, &types.LastObserverCount{Count: uint64(totalObserverCountCurrentBlock), LastChangeHeight: ctx.BlockHeight()})
}
package querytests
import (
"fmt"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/testutil/nullify"
"github.com/zeta-chain/zetacore/x/observer/client/cli"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowCrosschainFlags() {
ctx := s.network.Validators[0].ClientCtx
obj := s.observerState.CrosschainFlags
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
args []string
err error
obj *types.CrosschainFlags
}{
{
desc: "get",
args: common,
obj: obj,
},
} {
s.Run(tc.desc, func() {
var args []string
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowCrosschainFlags(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp types.QueryGetCrosschainFlagsResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.CrosschainFlags)
tc := tc
s.Require().Equal(nullify.Fill(&tc.obj),
nullify.Fill(&resp.CrosschainFlags),
)
}
})
}
}
package querytests
import (
"fmt"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/x/observer/client/cli"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowKeygen() {
ctx := s.network.Validators[0].ClientCtx
obj := s.observerState.Keygen
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
args []string
err error
obj *observerTypes.Keygen
}{
{
desc: "get",
args: common,
obj: obj,
},
} {
tc := tc
s.Run(tc.desc, func() {
var args []string
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowKeygen(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp observerTypes.QueryGetKeygenResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.Keygen)
s.Require().Equal(tc.obj, resp.Keygen)
}
})
}
}
package querytests
import (
"fmt"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/zeta-chain/zetacore/x/observer/client/cli"
zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s *CliTestSuite) TestShowNodeAccount() {
ctx := s.network.Validators[0].ClientCtx
objs := s.observerState.NodeAccountList
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
id string
args []string
err error
obj *zetaObserverTypes.NodeAccount
}{
{
desc: "found",
id: objs[0].Operator,
args: common,
obj: objs[0],
},
{
desc: "not found",
id: "not_found",
args: common,
err: status.Error(codes.InvalidArgument, "not found"),
},
} {
tc := tc
s.Run(tc.desc, func() {
args := []string{tc.id}
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowNodeAccount(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
var resp zetaObserverTypes.QueryGetNodeAccountResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NotNil(resp.NodeAccount)
s.Require().Equal(tc.obj, resp.NodeAccount)
}
})
}
}
package querytests
import (
sdk "github.com/cosmos/cosmos-sdk/types"
ethcfg "github.com/evmos/ethermint/cmd/config"
"github.com/stretchr/testify/suite"
"github.com/zeta-chain/zetacore/app"
cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config"
"github.com/zeta-chain/zetacore/testutil/network"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
type CliTestSuite struct {
suite.Suite
cfg network.Config
network *network.Network
crosschainState *types.GenesisState
observerState *observerTypes.GenesisState
}
func NewCLITestSuite(cfg network.Config) *CliTestSuite {
return &CliTestSuite{cfg: cfg}
}
func (s *CliTestSuite) Setconfig() {
config := sdk.GetConfig()
cmdcfg.SetBech32Prefixes(config)
ethcfg.SetBip44CoinType(config)
// Make sure address is compatible with ethereum
config.SetAddressVerifier(app.VerifyAddressFormat)
config.Seal()
}
func (s *CliTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")
s.Setconfig()
minOBsDel, ok := sdk.NewIntFromString("100000000000000000000")
s.Require().True(ok)
s.cfg.StakingTokens = minOBsDel.Mul(sdk.NewInt(int64(10)))
s.cfg.BondedTokens = minOBsDel
observerList := []string{"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax",
"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2",
}
network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false)
s.crosschainState = network.AddCrosschainData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec)
s.observerState = network.AddObserverData(s.T(), s.cfg.GenesisState, s.cfg.Codec, nil)
net, err := network.New(s.T(), app.NodeDir, s.cfg)
s.Assert().NoError(err)
s.network = net
_, err = s.network.WaitForHeight(1)
s.Require().NoError(err)
}
func (s *CliTestSuite) TearDownSuite() {
s.T().Log("tearing down genesis test suite")
s.network.Cleanup()
}
package observer
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/keeper"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// InitGenesis initializes the observer module's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
genesisObservers := genState.Observers
observerCount := uint64(0)
for _, mapper := range genesisObservers {
if mapper != nil {
k.SetObserverMapper(ctx, mapper)
observerCount += uint64(len(mapper.ObserverList))
}
}
// If core params are defined set them, otherwise set default
if len(genState.CoreParamsList.CoreParams) > 0 {
k.SetCoreParams(ctx, genState.CoreParamsList)
} else {
k.SetCoreParams(ctx, types.GetCoreParams())
}
// Set all the nodeAccount
for _, elem := range genState.NodeAccountList {
if elem != nil {
k.SetNodeAccount(ctx, *elem)
}
}
params := types.DefaultParams()
if genState.Params != nil {
params = *genState.Params
}
k.SetParams(ctx, params)
// Set if defined
crosschainFlags := types.DefaultCrosschainFlags()
if genState.CrosschainFlags != nil {
crosschainFlags.IsOutboundEnabled = genState.CrosschainFlags.IsOutboundEnabled
crosschainFlags.IsInboundEnabled = genState.CrosschainFlags.IsInboundEnabled
if genState.CrosschainFlags.BlockHeaderVerificationFlags != nil {
crosschainFlags.BlockHeaderVerificationFlags = genState.CrosschainFlags.BlockHeaderVerificationFlags
}
if genState.CrosschainFlags.GasPriceIncreaseFlags != nil {
crosschainFlags.GasPriceIncreaseFlags = genState.CrosschainFlags.GasPriceIncreaseFlags
}
k.SetCrosschainFlags(ctx, *crosschainFlags)
} else {
k.SetCrosschainFlags(ctx, *types.DefaultCrosschainFlags())
}
// Set if defined
if genState.Keygen != nil {
k.SetKeygen(ctx, *genState.Keygen)
}
ballotListForHeight := make(map[int64][]string)
if len(genState.Ballots) > 0 {
for _, ballot := range genState.Ballots {
if ballot != nil {
k.SetBallot(ctx, ballot)
ballotListForHeight[ballot.BallotCreationHeight] = append(ballotListForHeight[ballot.BallotCreationHeight], ballot.BallotIdentifier)
}
}
}
for height, ballotList := range ballotListForHeight {
k.SetBallotList(ctx, &types.BallotListForHeight{
Height: height,
BallotsIndexList: ballotList,
})
}
if genState.LastObserverCount != nil {
k.SetLastObserverCount(ctx, genState.LastObserverCount)
} else {
k.SetLastObserverCount(ctx, &types.LastObserverCount{LastChangeHeight: 0, Count: observerCount})
}
}
// ExportGenesis returns the observer module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
params := k.GetParams(ctx)
coreParams, found := k.GetAllCoreParams(ctx)
if !found {
coreParams = types.CoreParamsList{}
}
// Get all node accounts
nodeAccountList := k.GetAllNodeAccount(ctx)
nodeAccounts := make([]*types.NodeAccount, len(nodeAccountList))
for i, elem := range nodeAccountList {
elem := elem
nodeAccounts[i] = &elem
}
// Get all crosschain flags
cf := types.DefaultCrosschainFlags()
crosschainFlags, found := k.GetCrosschainFlags(ctx)
if found {
cf = &crosschainFlags
}
kn := &types.Keygen{}
keygen, found := k.GetKeygen(ctx)
if found {
kn = &keygen
}
oc := &types.LastObserverCount{}
observerCount, found := k.GetLastObserverCount(ctx)
if found {
oc = &observerCount
}
return &types.GenesisState{
Ballots: k.GetAllBallots(ctx),
Observers: k.GetAllObserverMappers(ctx),
CoreParamsList: coreParams,
Params: ¶ms,
NodeAccountList: nodeAccounts,
CrosschainFlags: cf,
Keygen: kn,
LastObserverCount: oc,
}
}
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) SetBallot(ctx sdk.Context, ballot *types.Ballot) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.VoterKey))
ballot.Index = ballot.BallotIdentifier
b := k.cdc.MustMarshal(ballot)
store.Set([]byte(ballot.Index), b)
}
func (k Keeper) SetBallotList(ctx sdk.Context, ballotlist *types.BallotListForHeight) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BallotListKey))
b := k.cdc.MustMarshal(ballotlist)
store.Set(types.BallotListKeyPrefix(ballotlist.Height), b)
}
func (k Keeper) GetBallot(ctx sdk.Context, index string) (val types.Ballot, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.VoterKey))
b := store.Get(types.KeyPrefix(index))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) GetBallotList(ctx sdk.Context, height int64) (val types.BallotListForHeight, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BallotListKey))
b := store.Get(types.BallotListKeyPrefix(height))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) GetAllBallots(ctx sdk.Context) (voters []*types.Ballot) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.VoterKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.Ballot
k.cdc.MustUnmarshal(iterator.Value(), &val)
voters = append(voters, &val)
}
return
}
// AddBallotToList adds a ballot to the list of ballots for a given height.
func (k Keeper) AddBallotToList(ctx sdk.Context, ballot types.Ballot) {
list, found := k.GetBallotList(ctx, ballot.BallotCreationHeight)
if !found {
list = types.BallotListForHeight{Height: ballot.BallotCreationHeight, BallotsIndexList: []string{}}
}
list.BallotsIndexList = append(list.BallotsIndexList, ballot.BallotIdentifier)
k.SetBallotList(ctx, &list)
}
// GetMaturedBallotList Returns a list of ballots which are matured at current height
func (k Keeper) GetMaturedBallotList(ctx sdk.Context) []string {
maturityBlocks := k.GetParams(ctx).BallotMaturityBlocks
list, found := k.GetBallotList(ctx, ctx.BlockHeight()-maturityBlocks)
if !found {
return []string{}
}
return list.BallotsIndexList
}
// Queries
func (k Keeper) BallotByIdentifier(goCtx context.Context, req *types.QueryBallotByIdentifierRequest) (*types.QueryBallotByIdentifierResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
ballot, found := k.GetBallot(ctx, req.BallotIdentifier)
if !found {
return nil, status.Error(codes.NotFound, "not found ballot")
}
votersList := make([]*types.VoterList, len(ballot.VoterList))
for i, voterAddress := range ballot.VoterList {
voter := types.VoterList{
VoterAddress: voterAddress,
VoteType: ballot.Votes[ballot.GetVoterIndex(voterAddress)],
}
votersList[i] = &voter
}
return &types.QueryBallotByIdentifierResponse{
BallotIdentifier: ballot.BallotIdentifier,
Voters: votersList,
ObservationType: ballot.ObservationType,
BallotStatus: ballot.BallotStatus,
}, nil
}
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) SetBlame(ctx sdk.Context, blame *types.Blame) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey))
b := k.cdc.MustMarshal(blame)
store.Set([]byte(blame.Index), b)
}
func (k Keeper) GetBlame(ctx sdk.Context, index string) (val types.Blame, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey))
b := store.Get(types.KeyPrefix(index))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) GetAllBlame(ctx sdk.Context) (BlameRecords []*types.Blame, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
found = false
for ; iterator.Valid(); iterator.Next() {
var val types.Blame
k.cdc.MustUnmarshal(iterator.Value(), &val)
BlameRecords = append(BlameRecords, &val)
found = true
}
return
}
func (k Keeper) GetBlamesByChainAndNonce(ctx sdk.Context, chainID int64, nonce int64) (BlameRecords []*types.Blame, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey))
blamePrefix := types.GetBlamePrefix(chainID, nonce)
iterator := sdk.KVStorePrefixIterator(store, []byte(blamePrefix))
defer iterator.Close()
found = false
for ; iterator.Valid(); iterator.Next() {
var val types.Blame
k.cdc.MustUnmarshal(iterator.Value(), &val)
BlameRecords = append(BlameRecords, &val)
found = true
}
return
}
// Query
func (k Keeper) BlameByIdentifier(goCtx context.Context, request *types.QueryBlameByIdentifierRequest) (*types.QueryBlameByIdentifierResponse, error) {
if request == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
blame, found := k.GetBlame(ctx, request.BlameIdentifier)
if !found {
return nil, status.Error(codes.NotFound, "blame info not found")
}
return &types.QueryBlameByIdentifierResponse{
BlameInfo: &blame,
}, nil
}
func (k Keeper) GetAllBlameRecords(goCtx context.Context, request *types.QueryAllBlameRecordsRequest) (*types.QueryAllBlameRecordsResponse, error) {
if request == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
blameRecords, found := k.GetAllBlame(ctx)
if !found {
return nil, status.Error(codes.NotFound, "blame info not found")
}
return &types.QueryAllBlameRecordsResponse{
BlameInfo: blameRecords,
}, nil
}
func (k Keeper) BlamesByChainAndNonce(goCtx context.Context, request *types.QueryBlameByChainAndNonceRequest) (*types.QueryBlameByChainAndNonceResponse, error) {
if request == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
blameRecords, found := k.GetBlamesByChainAndNonce(ctx, request.ChainId, request.Nonce)
if !found {
return nil, status.Error(codes.NotFound, "blame info not found")
}
return &types.QueryBlameByChainAndNonceResponse{
BlameInfo: blameRecords,
}, nil
}
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// SetBlockHeader set a specific block header in the store from its index
func (k Keeper) SetBlockHeader(ctx sdk.Context, header common.BlockHeader) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey))
b := k.cdc.MustMarshal(&header)
store.Set(header.Hash, b)
}
// GetBlockHeader returns a block header from its hash
func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey))
b := store.Get(hash)
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveBlockHeader removes a block header from the store
func (k Keeper) RemoveBlockHeader(ctx sdk.Context, hash []byte) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey))
store.Delete(hash)
}
// GetAllBlockHeaders queries all for block header
func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHeaderRequest) (*types.QueryAllBlockHeaderResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
blockHeaderStore := prefix.NewStore(store, types.KeyPrefix(types.BlockHeaderKey))
var blockHeaders []*common.BlockHeader
pageRes, err := query.Paginate(blockHeaderStore, req.Pagination, func(key []byte, value []byte) error {
var blockHeader common.BlockHeader
if err := k.cdc.Unmarshal(value, &blockHeader); err != nil {
return err
}
blockHeaders = append(blockHeaders, &blockHeader)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllBlockHeaderResponse{BlockHeaders: blockHeaders, Pagination: pageRes}, nil
}
// GetBlockHeaderByHash queries block header by hash
func (k Keeper) GetBlockHeaderByHash(c context.Context, req *types.QueryGetBlockHeaderByHashRequest) (*types.QueryGetBlockHeaderByHashResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
header, found := k.GetBlockHeader(sdk.UnwrapSDKContext(c), req.BlockHash)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetBlockHeaderByHashResponse{BlockHeader: &header}, nil
}
package keeper
import (
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// SetCrosschainFlags set the crosschain flags in the store
func (k Keeper) SetCrosschainFlags(ctx sdk.Context, crosschainFlags types.CrosschainFlags) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CrosschainFlagsKey))
b := k.cdc.MustMarshal(&crosschainFlags)
store.Set([]byte{0}, b)
}
// GetCrosschainFlags returns the crosschain flags
func (k Keeper) GetCrosschainFlags(ctx sdk.Context) (val types.CrosschainFlags, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CrosschainFlagsKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) IsInboundEnabled(ctx sdk.Context) (found bool) {
flags, found := k.GetCrosschainFlags(ctx)
if !found {
return false
}
return flags.IsInboundEnabled
}
func (k Keeper) IsOutboundEnabled(ctx sdk.Context) (found bool) {
flags, found := k.GetCrosschainFlags(ctx)
if !found {
return false
}
return flags.IsOutboundEnabled
}
// RemoveCrosschainFlags removes crosschain flags from the store
func (k Keeper) RemoveCrosschainFlags(ctx sdk.Context) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CrosschainFlagsKey))
store.Delete([]byte{0})
}
func (k Keeper) DisableInboundOnly(ctx sdk.Context) {
flags, found := k.GetCrosschainFlags(ctx)
if !found {
flags.IsOutboundEnabled = true
}
flags.IsInboundEnabled = false
k.SetCrosschainFlags(ctx, flags)
}
package keeper
import (
"strconv"
types2 "github.com/coinbase/rosetta-sdk-go/types"
sdk "github.com/cosmos/cosmos-sdk/types"
types "github.com/zeta-chain/zetacore/x/observer/types"
)
func EmitEventBallotCreated(ctx sdk.Context, ballot types.Ballot, observationHash, observationChain string) {
err := ctx.EventManager().EmitTypedEvent(&types.EventBallotCreated{
BallotIdentifier: ballot.BallotIdentifier,
BallotType: ballot.ObservationType.String(),
ObservationHash: observationHash,
ObservationChain: observationChain,
})
if err != nil {
ctx.Logger().Error("failed to emit EventBallotCreated : %s", err.Error())
}
}
func EmitEventKeyGenBlockUpdated(ctx sdk.Context, keygen *types.Keygen) {
err := ctx.EventManager().EmitTypedEvents(&types.EventKeygenBlockUpdated{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateKeygen{}),
KeygenBlock: strconv.Itoa(int(keygen.BlockNumber)),
KeygenPubkeys: types2.PrettyPrintStruct(keygen.GranteePubkeys),
})
if err != nil {
ctx.Logger().Error("Error emitting EventKeygenBlockUpdated :", err)
}
}
func EmitEventAddObserver(ctx sdk.Context, observerCount uint64, operatorAddress, zetaclientGranteeAddress, zetaclientGranteePubkey string) {
err := ctx.EventManager().EmitTypedEvents(&types.EventNewObserverAdded{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgAddObserver{}),
ObserverAddress: operatorAddress,
ZetaclientGranteeAddress: zetaclientGranteeAddress,
ZetaclientGranteePubkey: zetaclientGranteePubkey,
ObserverLastBlockCount: observerCount,
})
if err != nil {
ctx.Logger().Error("Error emitting EmitEventAddObserver :", err)
}
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) CrosschainFlags(c context.Context, req *types.QueryGetCrosschainFlagsRequest) (*types.QueryGetCrosschainFlagsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetCrosschainFlags(ctx)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetCrosschainFlagsResponse{CrosschainFlags: val}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
return &types.QueryParamsResponse{
Params: k.GetParams(ctx)}, nil
}
func (k Keeper) GetCoreParamsForChain(goCtx context.Context, req *types.QueryGetCoreParamsForChainRequest) (*types.QueryGetCoreParamsForChainResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
coreParams, found := k.GetCoreParamsByChainID(ctx, req.ChainId)
if !found {
return nil, status.Error(codes.NotFound, "core params not found")
}
return &types.QueryGetCoreParamsForChainResponse{
CoreParams: coreParams,
}, nil
}
func (k Keeper) GetCoreParams(goCtx context.Context, req *types.QueryGetCoreParamsRequest) (*types.QueryGetCoreParamsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
coreParams, found := k.GetAllCoreParams(ctx)
if !found {
return nil, status.Error(codes.NotFound, "core params not found")
}
return &types.QueryGetCoreParamsResponse{
CoreParams: &coreParams,
}, nil
}
package keeper
import (
"context"
"fmt"
"github.com/btcsuite/btcutil"
"github.com/zeta-chain/zetacore/common"
sdk "github.com/cosmos/cosmos-sdk/types"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// Prove simply checks two things:
// 1. the block header is available
// 2. the proof is valid
func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.QueryProveResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
blockHash, err := common.StringToHash(req.ChainId, req.BlockHash)
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
res, found := k.GetBlockHeader(ctx, blockHash)
if !found {
return nil, status.Error(codes.NotFound, "block header not found")
}
proven := false
txBytes, err := req.Proof.Verify(res.Header, int(req.TxIndex))
if err != nil && !common.IsErrorInvalidProof(err) {
return nil, status.Error(codes.Internal, err.Error())
}
if err == nil {
if common.IsEVMChain(req.ChainId) {
var txx ethtypes.Transaction
err = txx.UnmarshalBinary(txBytes)
if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("failed to unmarshal evm transaction: %s", err))
}
if txx.Hash().Hex() != req.TxHash {
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("tx hash mismatch: %s != %s", txx.Hash().Hex(), req.TxHash))
}
proven = true
} else if common.IsBitcoinChain(req.ChainId) {
tx, err := btcutil.NewTxFromBytes(txBytes)
if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("failed to unmarshal btc transaction: %s", err))
}
if tx.MsgTx().TxHash().String() != req.TxHash {
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("tx hash mismatch: %s != %s", tx.MsgTx().TxHash().String(), req.TxHash))
}
proven = true
} else {
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid chain id (%d)", req.ChainId))
}
}
return &types.QueryProveResponse{
Valid: proven,
}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) ShowObserverCount(goCtx context.Context, req *types.QueryShowObserverCountRequest) (*types.QueryShowObserverCountResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
lb, found := k.GetLastObserverCount(ctx)
if !found {
return nil, status.Error(codes.NotFound, "last observer count not found")
}
return &types.QueryShowObserverCountResponse{
LastObserverCount: &lb,
}, nil
}
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
var _ types.StakingHooks = Hooks{}
type Hooks struct {
k Keeper
}
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error {
err := h.k.CleanObservers(ctx, valAddr)
if err != nil {
return err
}
return nil
}
func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error {
err := h.k.CheckAndCleanObserver(ctx, valAddr)
if err != nil {
return err
}
return nil
}
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error {
err := h.k.CheckAndCleanObserverDelegator(ctx, valAddr, delAddr)
if err != nil {
return err
}
return nil
}
func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error {
err := h.k.CleanSlashedValidator(ctx, valAddr, fraction)
if err != nil {
return err
}
return nil
}
func (h Hooks) AfterValidatorCreated(_ sdk.Context, _ sdk.ValAddress) error {
return nil
}
func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error {
return nil
}
func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error {
return nil
}
func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error {
return nil
}
func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error {
return nil
}
func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error {
return nil
}
// Return the wrapper struct
func (k Keeper) Hooks() Hooks {
return Hooks{k}
}
func (k Keeper) CleanSlashedValidator(ctx sdk.Context, valAddress sdk.ValAddress, fraction sdk.Dec) error {
validator, found := k.stakingKeeper.GetValidator(ctx, valAddress)
if !found {
return types.ErrNotValidator
}
accAddress, err := types.GetAccAddressFromOperatorAddress(valAddress.String())
if err != nil {
return err
}
mappers := k.GetAllObserverMappersForAddress(ctx, accAddress.String())
if len(mappers) == 0 {
return nil
}
tokensToBurn := sdk.NewDecFromInt(validator.Tokens).Mul(fraction)
resultingTokens := validator.Tokens.Sub(tokensToBurn.Ceil().TruncateInt())
for _, mapper := range mappers {
obsParams := k.GetParams(ctx).GetParamsForChain(mapper.ObserverChain)
if !obsParams.IsSupported {
return types.ErrSupportedChains
}
if sdk.NewDecFromInt(resultingTokens).LT(obsParams.MinObserverDelegation) {
mapper.ObserverList = CleanAddressList(mapper.ObserverList, accAddress.String())
k.SetObserverMapper(ctx, mapper)
}
}
return nil
}
// CleanObservers cleans a observer Mapper without checking delegation amount
func (k Keeper) CleanObservers(ctx sdk.Context, valAddress sdk.ValAddress) error {
accAddress, err := types.GetAccAddressFromOperatorAddress(valAddress.String())
if err != nil {
return err
}
mappers := k.GetAllObserverMappersForAddress(ctx, accAddress.String())
for _, mapper := range mappers {
mapper.ObserverList = CleanAddressList(mapper.ObserverList, accAddress.String())
k.SetObserverMapper(ctx, mapper)
}
return nil
}
// CleanObservers cleans a observer Mapper checking delegation amount
func (k Keeper) CheckAndCleanObserver(ctx sdk.Context, valAddress sdk.ValAddress) error {
accAddress, err := types.GetAccAddressFromOperatorAddress(valAddress.String())
if err != nil {
return err
}
k.CleanMapper(ctx, accAddress)
return nil
}
// CleanObservers cleans a observer Mapper checking delegation amount for a speficific delagator. It is used when delgator is the validator .
// That is when when the validator is trying to remove self delgation
func (k Keeper) CheckAndCleanObserverDelegator(ctx sdk.Context, valAddress sdk.ValAddress, delAddress sdk.AccAddress) error {
accAddress, err := types.GetAccAddressFromOperatorAddress(valAddress.String())
if err != nil {
return err
}
if !(accAddress.String() == delAddress.String()) {
return nil
}
k.CleanMapper(ctx, accAddress)
return nil
}
func CleanAddressList(addresslist []string, address string) []string {
index := -1
for i, addr := range addresslist {
if addr == address {
index = i
}
}
if index != -1 {
addresslist = RemoveIndex(addresslist, index)
}
return addresslist
}
func RemoveIndex(s []string, index int) []string {
return append(s[:index], s[index+1:]...)
}
func (k Keeper) CleanMapper(ctx sdk.Context, accAddress sdk.AccAddress) {
mappers := k.GetAllObserverMappersForAddress(ctx, accAddress.String())
for _, mapper := range mappers {
err := k.CheckObserverDelegation(ctx, accAddress.String(), mapper.ObserverChain)
if err != nil {
mapper.ObserverList = CleanAddressList(mapper.ObserverList, accAddress.String())
k.SetObserverMapper(ctx, mapper)
}
}
}
package keeper
import (
"fmt"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
type (
Keeper struct {
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
memKey storetypes.StoreKey
paramstore paramtypes.Subspace
stakingKeeper types.StakingKeeper
}
)
func NewKeeper(
cdc codec.BinaryCodec,
storeKey,
memKey storetypes.StoreKey,
ps paramtypes.Subspace,
stakingKeeper types.StakingKeeper,
) *Keeper {
// set KeyTable if it has not already been set
if !ps.HasKeyTable() {
ps = ps.WithKeyTable(types.ParamKeyTable())
}
return &Keeper{
cdc: cdc,
storeKey: storeKey,
memKey: memKey,
paramstore: ps,
stakingKeeper: stakingKeeper,
}
}
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
func (k Keeper) StoreKey() storetypes.StoreKey {
return k.storeKey
}
func (k Keeper) Codec() codec.BinaryCodec {
return k.cdc
}
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// SetKeygen set keygen in the store
func (k Keeper) SetKeygen(ctx sdk.Context, keygen types.Keygen) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.KeygenKey))
b := k.cdc.MustMarshal(&keygen)
store.Set([]byte{0}, b)
}
// GetKeygen returns keygen
func (k Keeper) GetKeygen(ctx sdk.Context) (val types.Keygen, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.KeygenKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveKeygen removes keygen from the store
func (k Keeper) RemoveKeygen(ctx sdk.Context) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.KeygenKey))
store.Delete([]byte{0})
}
// Query
func (k Keeper) Keygen(c context.Context, _ *types.QueryGetKeygenRequest) (*types.QueryGetKeygenResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetKeygen(ctx)
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
return &types.QueryGetKeygenResponse{Keygen: &val}, nil
}
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// SetNodeAccount set a specific nodeAccount in the store from its index
func (k Keeper) SetNodeAccount(ctx sdk.Context, nodeAccount types.NodeAccount) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey))
b := k.cdc.MustMarshal(&nodeAccount)
store.Set(types.KeyPrefix(nodeAccount.Operator), b)
}
// GetNodeAccount returns a nodeAccount from its index
func (k Keeper) GetNodeAccount(ctx sdk.Context, index string) (val types.NodeAccount, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey))
b := store.Get(types.KeyPrefix(index))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveNodeAccount removes a nodeAccount from the store
func (k Keeper) RemoveNodeAccount(ctx sdk.Context, index string) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey))
store.Delete(types.KeyPrefix(index))
}
// GetAllNodeAccount returns all nodeAccount
func (k Keeper) GetAllNodeAccount(ctx sdk.Context) (list []types.NodeAccount) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.NodeAccount
k.cdc.MustUnmarshal(iterator.Value(), &val)
list = append(list, val)
}
return
}
// Queries
func (k Keeper) NodeAccountAll(c context.Context, req *types.QueryAllNodeAccountRequest) (*types.QueryAllNodeAccountResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
var nodeAccounts []*types.NodeAccount
ctx := sdk.UnwrapSDKContext(c)
store := ctx.KVStore(k.storeKey)
nodeAccountStore := prefix.NewStore(store, types.KeyPrefix(types.NodeAccountKey))
pageRes, err := query.Paginate(nodeAccountStore, req.Pagination, func(key []byte, value []byte) error {
var nodeAccount types.NodeAccount
if err := k.cdc.Unmarshal(value, &nodeAccount); err != nil {
return err
}
nodeAccounts = append(nodeAccounts, &nodeAccount)
return nil
})
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &types.QueryAllNodeAccountResponse{NodeAccount: nodeAccounts, Pagination: pageRes}, nil
}
func (k Keeper) NodeAccount(c context.Context, req *types.QueryGetNodeAccountRequest) (*types.QueryGetNodeAccountResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
val, found := k.GetNodeAccount(ctx, req.Index)
if !found {
return nil, status.Error(codes.InvalidArgument, "not found")
}
return &types.QueryGetNodeAccountResponse{NodeAccount: &val}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
func (k Keeper) SupportedChains(goCtx context.Context, _ *types.QuerySupportedChains) (*types.QuerySupportedChainsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
chains := k.GetParams(ctx).GetSupportedChains()
return &types.QuerySupportedChainsResponse{Chains: chains}, nil
}
package keeper
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/observer/types"
)
func (k Keeper) AddVoteToBallot(ctx sdk.Context, ballot types.Ballot, address string, observationType types.VoteType) (types.Ballot, error) {
ballot, err := ballot.AddVote(address, observationType)
if err != nil {
return ballot, err
}
ctx.Logger().Info(fmt.Sprintf("Vote Added | Voter :%s, ballot idetifier %s", address, ballot.BallotIdentifier))
k.SetBallot(ctx, &ballot)
return ballot, err
}
// CheckIfFinalizingVote checks if the ballot is finalized in this block and if it is, it sets the ballot in the store
// This function with only return true if the ballot moves for pending to success or failed status with this vote.
// If the ballot is already finalized in the previous vote , it will return false
func (k Keeper) CheckIfFinalizingVote(ctx sdk.Context, ballot types.Ballot) (types.Ballot, bool) {
ballot, isFinalized := ballot.IsBallotFinalized()
if !isFinalized {
return ballot, false
}
k.SetBallot(ctx, &ballot)
return ballot, true
}
// IsAuthorized checks whether a signer is authorized to sign , by checking their address against the observer mapper which contains the observer list for the chain and type
func (k Keeper) IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) bool {
observerMapper, found := k.GetObserverMapper(ctx, chain)
if !found {
return false
}
for _, obs := range observerMapper.ObserverList {
if obs == address {
return true
}
}
return false
}
func (k Keeper) FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType types.ObservationType) (ballot types.Ballot, isNew bool, err error) {
isNew = false
ballot, found := k.GetBallot(ctx, index)
if !found {
observerMapper, _ := k.GetObserverMapper(ctx, chain)
obsParams := k.GetParams(ctx).GetParamsForChain(chain)
if !obsParams.IsSupported {
err = errors.Wrap(types.ErrSupportedChains, fmt.Sprintf("Thresholds not set for Chain %s and Observation %s", chain.String(), observationType))
return
}
ballot = types.Ballot{
Index: "",
BallotIdentifier: index,
VoterList: observerMapper.ObserverList,
Votes: types.CreateVotes(len(observerMapper.ObserverList)),
ObservationType: observationType,
BallotThreshold: obsParams.BallotThreshold,
BallotStatus: types.BallotStatus_BallotInProgress,
BallotCreationHeight: ctx.BlockHeight(),
}
isNew = true
k.AddBallotToList(ctx, ballot)
}
return
}
func (k Keeper) IsValidator(ctx sdk.Context, creator string) error {
valAddress, err := types.GetOperatorAddressFromAccAddress(creator)
if err != nil {
return err
}
validator, found := k.stakingKeeper.GetValidator(ctx, valAddress)
if !found {
return types.ErrNotValidator
}
if validator.Jailed == true || validator.IsBonded() == false {
return types.ErrValidatorStatus
}
return nil
}
func (k Keeper) CheckObserverDelegation(ctx sdk.Context, accAddress string, chain *common.Chain) error {
selfdelAddr, err := sdk.AccAddressFromBech32(accAddress)
if err != nil {
return err
}
valAddress, err := types.GetOperatorAddressFromAccAddress(accAddress)
if err != nil {
return err
}
validator, found := k.stakingKeeper.GetValidator(ctx, valAddress)
if !found {
return types.ErrNotValidator
}
delegation, found := k.stakingKeeper.GetDelegation(ctx, selfdelAddr, valAddress)
if !found {
return types.ErrSelfDelegation
}
obsParams := k.GetParams(ctx).GetParamsForChain(chain)
if !obsParams.IsSupported {
return errors.Wrap(types.ErrSupportedChains, fmt.Sprintf("Chain not suported %s ", chain.String()))
}
tokens := validator.TokensFromShares(delegation.Shares)
if tokens.LT(obsParams.MinObserverDelegation) {
return types.ErrCheckObserverDelegation
}
return nil
}
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
v2 "github.com/zeta-chain/zetacore/x/observer/migrations/v2"
v3 "github.com/zeta-chain/zetacore/x/observer/migrations/v3"
v4 "github.com/zeta-chain/zetacore/x/observer/migrations/v4"
)
// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
observerKeeper Keeper
}
// NewMigrator returns a new Migrator.
func NewMigrator(keeper Keeper) Migrator {
return Migrator{
observerKeeper: keeper,
}
}
// Migrate1to2 migrates the store from consensus version 1 to 2
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2.MigrateStore(ctx, m.observerKeeper.storeKey, m.observerKeeper.cdc)
}
// Migrate2to3 migrates the store from consensus version 2 to 3
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
return v3.MigrateStore(ctx, m.observerKeeper)
}
func (m Migrator) Migrate3to4(ctx sdk.Context) error {
return v4.MigrateStore(ctx, m.observerKeeper.storeKey, m.observerKeeper.cdc)
}
package keeper
import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
type msgServer struct {
Keeper
}
// NewMsgServerImpl returns an implementation of the MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}
var _ types.MsgServer = msgServer{}
package keeper
import (
"context"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
crosschainTypes "github.com/zeta-chain/zetacore/x/crosschain/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
func (k msgServer) AddBlameVote(goCtx context.Context, vote *types.MsgAddBlameVote) (*types.MsgAddBlameVoteResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
observationType := types.ObservationType_TSSKeySign
// GetChainFromChainID makes sure we are getting only supported chains , if a chain support has been turned on using gov proposal, this function returns nil
observationChain := k.GetParams(ctx).GetChainFromChainID(vote.ChainId)
if observationChain == nil {
return nil, sdkerrors.Wrap(crosschainTypes.ErrUnsupportedChain, fmt.Sprintf("ChainID %d, Blame vote", vote.ChainId))
}
// IsAuthorized does various checks against the list of observer mappers
if ok := k.IsAuthorized(ctx, vote.Creator, observationChain); !ok {
return nil, types.ErrNotAuthorizedPolicy
}
index := vote.Digest()
// Add votes and Set Ballot
// GetBallot checks against the supported chains list before querying for Ballot
ballot, isNew, err := k.FindBallot(ctx, index, observationChain, observationType)
if err != nil {
return nil, err
}
if isNew {
EmitEventBallotCreated(ctx, ballot, vote.BlameInfo.Index, observationChain.String())
}
// AddVoteToBallot adds a vote and sets the ballot
ballot, err = k.AddVoteToBallot(ctx, ballot, vote.Creator, types.VoteType_SuccessObservation)
if err != nil {
return nil, err
}
_, isFinalized := k.CheckIfFinalizingVote(ctx, ballot)
if !isFinalized {
// Return nil here to add vote to ballot and commit state
return &types.MsgAddBlameVoteResponse{}, nil
}
// ******************************************************************************
// below only happens when ballot is finalized: exactly when threshold vote is in
// ******************************************************************************
k.SetBlame(ctx, vote.BlameInfo)
return &types.MsgAddBlameVoteResponse{}, nil
}
package keeper
import (
"context"
"fmt"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// AddBlockHeader handles adding a block header to the store, through majority voting of observers
func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockHeader) (*types.MsgAddBlockHeaderResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// check authorization for this chain
chain := common.GetChainFromChainID(msg.ChainId)
if ok := k.IsAuthorized(ctx, msg.Creator, chain); !ok {
return nil, types.ErrNotAuthorizedPolicy
}
crosschainFlags, found := k.GetCrosschainFlags(ctx)
if !found {
return nil, fmt.Errorf("crosschain flags not found")
}
if crosschainFlags.BlockHeaderVerificationFlags == nil {
return nil, fmt.Errorf("block header verification flags not found")
}
if common.IsBitcoinChain(msg.ChainId) && !crosschainFlags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled {
return nil, cosmoserrors.Wrapf(types.ErrBlockHeaderVerficationDisabled, "proof verification not enabled for bitcoin ,chain id: %d", msg.ChainId)
}
if common.IsEVMChain(msg.ChainId) && !crosschainFlags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled {
return nil, cosmoserrors.Wrapf(types.ErrBlockHeaderVerficationDisabled, "proof verification not enabled for evm ,chain id: %d", msg.ChainId)
}
// add vote to ballot
ballot, _, err := k.FindBallot(ctx, msg.Digest(), chain, types.ObservationType_InBoundTx)
if err != nil {
return nil, cosmoserrors.Wrap(err, "failed to find ballot")
}
ballot, err = k.AddVoteToBallot(ctx, ballot, msg.Creator, types.VoteType_SuccessObservation)
if err != nil {
return nil, cosmoserrors.Wrap(err, "failed to add vote to ballot")
}
_, isFinalized := k.CheckIfFinalizingVote(ctx, ballot)
if !isFinalized {
return &types.MsgAddBlockHeaderResponse{}, nil
}
/**
* Vote finalized, add block header to store
*/
_, found = k.GetBlockHeader(ctx, msg.BlockHash)
if found {
hashString, err := common.HashToString(msg.ChainId, msg.BlockHash)
if err != nil {
return nil, cosmoserrors.Wrap(err, "block hash conversion failed")
}
return nil, cosmoserrors.Wrap(types.ErrBlockAlreadyExist, hashString)
}
// Check timestamp
err = msg.Header.ValidateTimestamp(ctx.BlockTime())
if err != nil {
return nil, cosmoserrors.Wrap(types.ErrInvalidTimestamp, err.Error())
}
// NOTE: error is checked in BasicValidation in msg; check again for extra caution
pHash, err := msg.Header.ParentHash()
if err != nil {
return nil, cosmoserrors.Wrap(types.ErrNoParentHash, err.Error())
}
// TODO: add check for parent block header's existence here https://github.com/zeta-chain/node/issues/1133
bh := common.BlockHeader{
Header: msg.Header,
Height: msg.Height,
Hash: msg.BlockHash,
ParentHash: pHash,
ChainId: msg.ChainId,
}
k.SetBlockHeader(ctx, bh)
return &types.MsgAddBlockHeaderResponse{}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// UpdateCoreParams updates core parameters for a specific chain. Core parameters include
// confirmation count, outbound transaction schedule interval, ZETA token,
// connector and ERC20 custody contract addresses, etc.
//
// Throws an error if the chain ID is not supported.
//
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) UpdateCoreParams(goCtx context.Context, msg *types.MsgUpdateCoreParams) (*types.MsgUpdateCoreParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group2) {
return &types.MsgUpdateCoreParamsResponse{}, types.ErrNotAuthorizedPolicy
}
if !k.GetParams(ctx).IsChainIDSupported(msg.CoreParams.ChainId) {
return &types.MsgUpdateCoreParamsResponse{}, types.ErrSupportedChains
}
coreParams, found := k.GetAllCoreParams(ctx)
if !found {
return &types.MsgUpdateCoreParamsResponse{}, types.ErrCoreParamsNotSet
}
newCoreParams := make([]*types.CoreParams, len(coreParams.CoreParams))
for i, cp := range coreParams.CoreParams {
if cp.ChainId == msg.CoreParams.ChainId {
newCoreParams[i] = msg.CoreParams
continue
}
newCoreParams[i] = cp
}
k.SetCoreParams(ctx, types.CoreParamsList{CoreParams: newCoreParams})
return &types.MsgUpdateCoreParamsResponse{}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// UpdateCrosschainFlags updates the crosschain related flags.
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) UpdateCrosschainFlags(goCtx context.Context, msg *types.MsgUpdateCrosschainFlags) (*types.MsgUpdateCrosschainFlagsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
requiredGroup := types.Policy_Type_group1
if msg.IsInboundEnabled || msg.IsOutboundEnabled || msg.GasPriceIncreaseFlags != nil {
requiredGroup = types.Policy_Type_group2
}
// check permission
if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(requiredGroup) {
return &types.MsgUpdateCrosschainFlagsResponse{}, types.ErrNotAuthorizedPolicy
}
// check if the value exists
flags, isFound := k.GetCrosschainFlags(ctx)
if !isFound {
flags = *types.DefaultCrosschainFlags()
}
// update values
flags.IsInboundEnabled = msg.IsInboundEnabled
flags.IsOutboundEnabled = msg.IsOutboundEnabled
if msg.GasPriceIncreaseFlags != nil {
flags.GasPriceIncreaseFlags = msg.GasPriceIncreaseFlags
}
if msg.BlockHeaderVerificationFlags != nil {
flags.BlockHeaderVerificationFlags = msg.BlockHeaderVerificationFlags
}
k.SetCrosschainFlags(ctx, flags)
err := ctx.EventManager().EmitTypedEvents(&types.EventCrosschainFlagsUpdated{
MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateCrosschainFlags{}),
IsInboundEnabled: msg.IsInboundEnabled,
IsOutboundEnabled: msg.IsOutboundEnabled,
GasPriceIncreaseFlags: msg.GasPriceIncreaseFlags,
BlockHeaderVerificationFlags: msg.BlockHeaderVerificationFlags,
Signer: msg.Creator,
})
if err != nil {
ctx.Logger().Error("Error emitting EventCrosschainFlagsUpdated :", err)
}
return &types.MsgUpdateCrosschainFlagsResponse{}, nil
}
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// UpdateKeygen updates the block height of the keygen and sets the status to "pending keygen".
//
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) UpdateKeygen(goCtx context.Context, msg *types.MsgUpdateKeygen) (*types.MsgUpdateKeygenResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group1) {
return &types.MsgUpdateKeygenResponse{}, types.ErrNotAuthorizedPolicy
}
keygen, found := k.GetKeygen(ctx)
if !found {
return nil, types.ErrKeygenNotFound
}
if msg.Block <= (ctx.BlockHeight() + 10) {
return nil, types.ErrKeygenBlockTooLow
}
nodeAccountList := k.GetAllNodeAccount(ctx)
granteePubKeys := make([]string, len(nodeAccountList))
for i, nodeAccount := range nodeAccountList {
granteePubKeys[i] = nodeAccount.GranteePubkey.Secp256k1.String()
}
keygen.GranteePubkeys = granteePubKeys
keygen.BlockNumber = msg.Block
keygen.Status = types.KeygenStatus_PendingKeygen
k.SetKeygen(ctx, keygen)
EmitEventKeyGenBlockUpdated(ctx, &keygen)
return &types.MsgUpdateKeygenResponse{}, nil
}
package keeper
import (
"context"
"fmt"
"math"
cosmoserrors "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func GetObserverMapperIndex(chain *common.Chain) string {
return fmt.Sprintf("%d", chain.ChainId)
}
func (k Keeper) SetLastObserverCount(ctx sdk.Context, lbc *types.LastObserverCount) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockObserverCountKey))
b := k.cdc.MustMarshal(lbc)
store.Set([]byte{0}, b)
}
func (k Keeper) GetLastObserverCount(ctx sdk.Context) (val types.LastObserverCount, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockObserverCountKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) SetObserverMapper(ctx sdk.Context, om *types.ObserverMapper) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ObserverMapperKey))
om.Index = GetObserverMapperIndex(om.ObserverChain)
b := k.cdc.MustMarshal(om)
store.Set([]byte(om.Index), b)
}
func (k Keeper) GetObserverMapper(ctx sdk.Context, chain *common.Chain) (val types.ObserverMapper, found bool) {
index := GetObserverMapperIndex(chain)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ObserverMapperKey))
b := store.Get(types.KeyPrefix(index))
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
func (k Keeper) GetAllObserverMappers(ctx sdk.Context) (mappers []*types.ObserverMapper) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ObserverMapperKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.ObserverMapper
k.cdc.MustUnmarshal(iterator.Value(), &val)
mappers = append(mappers, &val)
}
return
}
func (k Keeper) GetAllObserverMappersForAddress(ctx sdk.Context, address string) (mappers []*types.ObserverMapper) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ObserverMapperKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var val types.ObserverMapper
k.cdc.MustUnmarshal(iterator.Value(), &val)
addToList := false
for _, addr := range val.ObserverList {
if addr == address {
addToList = true
}
}
if addToList {
mappers = append(mappers, &val)
}
}
return
}
// Tx
// AddObserver adds in a new observer to the store.It can be executed using an admin policy account
// Once added, the function also resets keygen and pauses inbound so that a new TSS can be generated.
func (k msgServer) AddObserver(goCtx context.Context, msg *types.MsgAddObserver) (*types.MsgAddObserverResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group2) {
return &types.MsgAddObserverResponse{}, types.ErrNotAuthorizedPolicy
}
pubkey, err := common.NewPubKey(msg.ZetaclientGranteePubkey)
if err != nil {
return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error())
}
granteeAddress, err := common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey)
if err != nil {
return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error())
}
k.DisableInboundOnly(ctx)
// AddNodeAccountOnly flag usage
// True: adds observer into the Node Account list but returns without adding to the observer list
// False: adds observer to the observer list, and not the node account list
// Inbound is disabled in both cases and needs to be enabled manually using an admin TX
if msg.AddNodeAccountOnly {
pubkeySet := common.PubKeySet{Secp256k1: pubkey, Ed25519: ""}
k.SetNodeAccount(ctx, types.NodeAccount{
Operator: msg.ObserverAddress,
GranteeAddress: granteeAddress.String(),
GranteePubkey: &pubkeySet,
NodeStatus: types.NodeStatus_Active,
})
k.SetKeygen(ctx, types.Keygen{BlockNumber: math.MaxInt64})
return &types.MsgAddObserverResponse{}, nil
}
observerMappers := k.GetAllObserverMappers(ctx)
totalObserverCountCurrentBlock := uint64(0)
for _, mapper := range observerMappers {
mapper.ObserverList = append(mapper.ObserverList, msg.ObserverAddress)
totalObserverCountCurrentBlock += uint64(len(mapper.ObserverList))
k.SetObserverMapper(ctx, mapper)
}
k.SetLastObserverCount(ctx, &types.LastObserverCount{Count: totalObserverCountCurrentBlock})
EmitEventAddObserver(ctx, totalObserverCountCurrentBlock, msg.ObserverAddress, granteeAddress.String(), msg.ZetaclientGranteePubkey)
return &types.MsgAddObserverResponse{}, nil
}
//Queries
func (k Keeper) ObserversByChain(goCtx context.Context, req *types.QueryObserversByChainRequest) (*types.QueryObserversByChainResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
// TODO move parsing to client
// https://github.com/zeta-chain/node/issues/867
chainName := common.ParseChainName(req.ObservationChain)
chain := k.GetParams(ctx).GetChainFromChainName(chainName)
if chain == nil {
return &types.QueryObserversByChainResponse{}, types.ErrSupportedChains
}
mapper, found := k.GetObserverMapper(ctx, chain)
if !found {
return &types.QueryObserversByChainResponse{}, types.ErrObserverNotPresent
}
return &types.QueryObserversByChainResponse{Observers: mapper.ObserverList}, nil
}
func (k Keeper) AllObserverMappers(goCtx context.Context, req *types.QueryAllObserverMappersRequest) (*types.QueryAllObserverMappersResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
mappers := k.GetAllObserverMappers(ctx)
return &types.QueryAllObserverMappersResponse{ObserverMappers: mappers}, nil
}
// Utils
func (k Keeper) GetAllObserverAddresses(ctx sdk.Context) []string {
var val []string
mappers := k.GetAllObserverMappers(ctx)
for _, mapper := range mappers {
val = append(val, mapper.ObserverList...)
}
allKeys := make(map[string]bool)
var dedupedList []string
for _, item := range val {
if _, value := allKeys[item]; !value {
allKeys[item] = true
dedupedList = append(dedupedList, item)
}
}
return dedupedList
}
func (k Keeper) AddObserverToMapper(ctx sdk.Context, chain *common.Chain, address string) {
mapper, found := k.GetObserverMapper(ctx, chain)
if !found {
k.SetObserverMapper(ctx, &types.ObserverMapper{
Index: "",
ObserverChain: chain,
ObserverList: []string{address},
})
return
}
// Return if duplicate
for _, addr := range mapper.ObserverList {
if addr == address {
return
}
}
mapper.ObserverList = append(mapper.ObserverList, address)
k.SetObserverMapper(ctx, &mapper)
}
package keeper
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
k.paramstore.GetParamSet(ctx, ¶ms)
return
}
func (k Keeper) GetParamsIsExists(ctx sdk.Context) (params types.Params) {
k.paramstore.GetParamSetIfExists(ctx, ¶ms)
return
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, ¶ms)
}
func (k Keeper) SetCoreParams(ctx sdk.Context, coreParams types.CoreParamsList) {
store := ctx.KVStore(k.storeKey)
b := k.cdc.MustMarshal(&coreParams)
key := types.KeyPrefix(fmt.Sprintf("%s", types.AllCoreParams))
store.Set(key, b)
}
func (k Keeper) GetAllCoreParams(ctx sdk.Context) (val types.CoreParamsList, found bool) {
found = false
store := ctx.KVStore(k.storeKey)
b := store.Get(types.KeyPrefix(fmt.Sprintf("%s", types.AllCoreParams)))
if b == nil {
return
}
found = true
k.cdc.MustUnmarshal(b, &val)
return
}
func (k Keeper) GetCoreParamsByChainID(ctx sdk.Context, chainID int64) (*types.CoreParams, bool) {
allCoreParams, found := k.GetAllCoreParams(ctx)
if !found {
return &types.CoreParams{}, false
}
for _, coreParams := range allCoreParams.CoreParams {
if coreParams.ChainId == chainID {
return coreParams, true
}
}
return &types.CoreParams{}, false
}
package v3
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
type ObserverKeeper interface {
GetParamsIsExists(ctx sdk.Context) types.Params
SetParams(ctx sdk.Context, params types.Params)
}
// MigrateStore migrates the x/observer module state from the consensus version 2 to 3
// This migration update the policy group
func MigrateStore(ctx sdk.Context, k ObserverKeeper) error {
// Get first admin policy group
p := k.GetParamsIsExists(ctx)
if len(p.AdminPolicy) == 0 || p.AdminPolicy[0] == nil {
return nil
}
admin := p.AdminPolicy[0].Address
p.AdminPolicy = []*types.Admin_Policy{
{
Address: admin,
PolicyType: types.Policy_Type_group1,
},
{
Address: admin,
PolicyType: types.Policy_Type_group2,
},
}
k.SetParams(ctx, p)
return nil
}
package v4
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
)
func MigrateStore(ctx sdk.Context, observerStoreKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
newCrossChainFlags := types.DefaultCrosschainFlags()
var val types.LegacyCrosschainFlags
store := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.CrosschainFlagsKey))
b := store.Get([]byte{0})
if b != nil {
cdc.MustUnmarshal(b, &val)
if val.GasPriceIncreaseFlags != nil {
newCrossChainFlags.GasPriceIncreaseFlags = val.GasPriceIncreaseFlags
}
newCrossChainFlags.IsOutboundEnabled = val.IsOutboundEnabled
newCrossChainFlags.IsInboundEnabled = val.IsInboundEnabled
}
b, err := cdc.Marshal(newCrossChainFlags)
if err != nil {
return err
}
store.Set([]byte{0}, b)
return nil
}
package observer
import (
"context"
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/zeta-chain/zetacore/x/observer/client/cli"
"github.com/zeta-chain/zetacore/x/observer/keeper"
"github.com/zeta-chain/zetacore/x/observer/types"
)
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
)
// ----------------------------------------------------------------------------
// AppModuleBasic
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the observer module.
type AppModuleBasic struct {
cdc codec.BinaryCodec
}
func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic {
return AppModuleBasic{cdc: cdc}
}
// Name returns the observer module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
}
func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}
// RegisterInterfaces registers the module's interface types
func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}
// DefaultGenesis returns the observer module's default genesis state.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesis())
}
// ValidateGenesis performs genesis state validation for the observer module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return genState.Validate()
}
// RegisterRESTRoutes registers the observer module's REST service handlers.
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {
fmt.Println("RegisterQueryHandlerClient err: %w", err)
}
}
// GetTxCmd returns the observer module's root tx command.
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}
// GetQueryCmd returns the observer module's root query command.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(types.StoreKey)
}
// ----------------------------------------------------------------------------
// AppModule
// ----------------------------------------------------------------------------
// AppModule implements the AppModule interface for the observer module.
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
accountKeeper types.AccountKeeper
bankKeeper types.BankKeeper
}
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
}
}
// Name returns the observer module's name.
func (am AppModule) Name() string {
return am.AppModuleBasic.Name()
}
// Route returns the observer module's message routing key.
func (am AppModule) Route() sdk.Route {
return sdk.Route{}
}
// QuerierRoute returns the observer module's query routing key.
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
// LegacyQuerierHandler returns the observer module's Querier.
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
m := keeper.NewMigrator(am.keeper)
if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil {
panic(err)
}
if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil {
panic(err)
}
if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4); err != nil {
panic(err)
}
}
// RegisterInvariants registers the observer module's invariants.
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// InitGenesis performs the observer module's genesis initialization It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate {
var genState types.GenesisState
// Initialize global index to index in genesis state
cdc.MustUnmarshalJSON(gs, &genState)
InitGenesis(ctx, am.keeper, genState)
return []abci.ValidatorUpdate{}
}
// ExportGenesis returns the observer module's exported genesis state as raw JSON bytes.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
genState := ExportGenesis(ctx, am.keeper)
return cdc.MustMarshalJSON(genState)
}
// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 3 }
// BeginBlock executes all ABCI BeginBlock logic respective to the observer module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
BeginBlocker(ctx, am.keeper)
}
// EndBlock executes all ABCI EndBlock logic respective to the observer module. It
// returns no validator updates.
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}
package observer
import (
"math/rand"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/zeta-chain/zetacore/x/observer/types"
)
/* #nosec */
const (
// #nosec G101 not a hardcoded credential
opWeightMsgUpdateClientParams = "op_weight_msg_update_client_params"
defaultWeightMsgUpdateClientParams int = 100
)
// GenerateGenesisState creates a randomized GenState of the module
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
accs := make([]string, len(simState.Accounts))
for i, acc := range simState.Accounts {
accs[i] = acc.Address.String()
}
defaultParams := types.DefaultParams()
observerGenesis := types.GenesisState{
Params: &defaultParams,
}
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&observerGenesis)
}
// ProposalContents doesn't return any content functions for governance proposals
func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent {
return nil
}
// RandomizedParams creates randomized param changes for the simulator
func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange {
return []simtypes.ParamChange{}
}
// RegisterStoreDecoder registers a decoder
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {}
// WeightedOperations returns the all the gov module operations with their respective weights.
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
operations := make([]simtypes.WeightedOperation, 0)
var weightMsgUpdateClientParams int
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUpdateClientParams, &weightMsgUpdateClientParams, nil,
func(_ *rand.Rand) {
weightMsgUpdateClientParams = defaultWeightMsgUpdateClientParams
},
)
return operations
}
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
)
func (m Ballot) AddVote(address string, vote VoteType) (Ballot, error) {
if m.HasVoted(address) {
return m, errors.Wrap(ErrUnableToAddVote, fmt.Sprintf(" Voter : %s | Ballot :%s | Already Voted", address, m.String()))
}
// `index` is the index of the `address` in the `VoterList`
// `index` is used to set the vote in the `Votes` array
index := m.GetVoterIndex(address)
m.Votes[index] = vote
return m, nil
}
func (m Ballot) HasVoted(address string) bool {
index := m.GetVoterIndex(address)
return m.Votes[index] != VoteType_NotYetVoted
}
// GetVoterIndex returns the index of the `address` in the `VoterList`
func (m Ballot) GetVoterIndex(address string) int {
index := -1
for i, addr := range m.VoterList {
if addr == address {
return i
}
}
return index
}
func (m Ballot) IsBallotFinalized() (Ballot, bool) {
if m.BallotStatus != BallotStatus_BallotInProgress {
return m, false
}
success, failure := sdk.ZeroDec(), sdk.ZeroDec()
total := sdk.NewDec(int64(len(m.VoterList)))
for _, vote := range m.Votes {
if vote == VoteType_SuccessObservation {
success = success.Add(sdk.OneDec())
}
if vote == VoteType_FailureObservation {
failure = failure.Add(sdk.OneDec())
}
}
if failure.IsPositive() {
if failure.Quo(total).GTE(m.BallotThreshold) {
m.BallotStatus = BallotStatus_BallotFinalized_FailureObservation
return m, true
}
}
if success.IsPositive() {
if success.Quo(total).GTE(m.BallotThreshold) {
m.BallotStatus = BallotStatus_BallotFinalized_SuccessObservation
return m, true
}
}
return m, false
}
func CreateVotes(len int) []VoteType {
voterList := make([]VoteType, len)
for i := range voterList {
voterList[i] = VoteType_NotYetVoted
}
return voterList
}
// BuildRewardsDistribution builds the rewards distribution map for the ballot
// It returns the total rewards units which account for the observer block rewards
func (m Ballot) BuildRewardsDistribution(rewardsMap map[string]int64) int64 {
totalRewardUnits := int64(0)
switch m.BallotStatus {
case BallotStatus_BallotFinalized_SuccessObservation:
for _, address := range m.VoterList {
vote := m.Votes[m.GetVoterIndex(address)]
if vote == VoteType_SuccessObservation {
rewardsMap[address] = rewardsMap[address] + 1
totalRewardUnits++
continue
}
rewardsMap[address] = rewardsMap[address] - 1
}
case BallotStatus_BallotFinalized_FailureObservation:
for _, address := range m.VoterList {
vote := m.Votes[m.GetVoterIndex(address)]
if vote == VoteType_FailureObservation {
rewardsMap[address] = rewardsMap[address] + 1
totalRewardUnits++
continue
}
rewardsMap[address] = rewardsMap[address] - 1
}
}
return totalRewardUnits
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/ballot.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type VoteType int32
const (
VoteType_SuccessObservation VoteType = 0
VoteType_FailureObservation VoteType = 1
VoteType_NotYetVoted VoteType = 2
)
var VoteType_name = map[int32]string{
0: "SuccessObservation",
1: "FailureObservation",
2: "NotYetVoted",
}
var VoteType_value = map[string]int32{
"SuccessObservation": 0,
"FailureObservation": 1,
"NotYetVoted": 2,
}
func (x VoteType) String() string {
return proto.EnumName(VoteType_name, int32(x))
}
func (VoteType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_9eac86b249c97b5b, []int{0}
}
type BallotStatus int32
const (
BallotStatus_BallotFinalized_SuccessObservation BallotStatus = 0
BallotStatus_BallotFinalized_FailureObservation BallotStatus = 1
BallotStatus_BallotInProgress BallotStatus = 2
)
var BallotStatus_name = map[int32]string{
0: "BallotFinalized_SuccessObservation",
1: "BallotFinalized_FailureObservation",
2: "BallotInProgress",
}
var BallotStatus_value = map[string]int32{
"BallotFinalized_SuccessObservation": 0,
"BallotFinalized_FailureObservation": 1,
"BallotInProgress": 2,
}
func (x BallotStatus) String() string {
return proto.EnumName(BallotStatus_name, int32(x))
}
func (BallotStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_9eac86b249c97b5b, []int{1}
}
type Ballot struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
BallotIdentifier string `protobuf:"bytes,2,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"`
VoterList []string `protobuf:"bytes,3,rep,name=voter_list,json=voterList,proto3" json:"voter_list,omitempty"`
Votes []VoteType `protobuf:"varint,4,rep,packed,name=votes,proto3,enum=zetachain.zetacore.observer.VoteType" json:"votes,omitempty"`
ObservationType ObservationType `protobuf:"varint,5,opt,name=observation_type,json=observationType,proto3,enum=zetachain.zetacore.observer.ObservationType" json:"observation_type,omitempty"`
BallotThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=ballot_threshold,json=ballotThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"ballot_threshold"`
BallotStatus BallotStatus `protobuf:"varint,7,opt,name=ballot_status,json=ballotStatus,proto3,enum=zetachain.zetacore.observer.BallotStatus" json:"ballot_status,omitempty"`
BallotCreationHeight int64 `protobuf:"varint,8,opt,name=ballot_creation_height,json=ballotCreationHeight,proto3" json:"ballot_creation_height,omitempty"`
}
func (m *Ballot) Reset() { *m = Ballot{} }
func (m *Ballot) String() string { return proto.CompactTextString(m) }
func (*Ballot) ProtoMessage() {}
func (*Ballot) Descriptor() ([]byte, []int) {
return fileDescriptor_9eac86b249c97b5b, []int{0}
}
func (m *Ballot) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Ballot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Ballot.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Ballot) XXX_Merge(src proto.Message) {
xxx_messageInfo_Ballot.Merge(m, src)
}
func (m *Ballot) XXX_Size() int {
return m.Size()
}
func (m *Ballot) XXX_DiscardUnknown() {
xxx_messageInfo_Ballot.DiscardUnknown(m)
}
var xxx_messageInfo_Ballot proto.InternalMessageInfo
func (m *Ballot) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *Ballot) GetBallotIdentifier() string {
if m != nil {
return m.BallotIdentifier
}
return ""
}
func (m *Ballot) GetVoterList() []string {
if m != nil {
return m.VoterList
}
return nil
}
func (m *Ballot) GetVotes() []VoteType {
if m != nil {
return m.Votes
}
return nil
}
func (m *Ballot) GetObservationType() ObservationType {
if m != nil {
return m.ObservationType
}
return ObservationType_EmptyObserverType
}
func (m *Ballot) GetBallotStatus() BallotStatus {
if m != nil {
return m.BallotStatus
}
return BallotStatus_BallotFinalized_SuccessObservation
}
func (m *Ballot) GetBallotCreationHeight() int64 {
if m != nil {
return m.BallotCreationHeight
}
return 0
}
type BallotListForHeight struct {
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
BallotsIndexList []string `protobuf:"bytes,2,rep,name=ballots_index_list,json=ballotsIndexList,proto3" json:"ballots_index_list,omitempty"`
}
func (m *BallotListForHeight) Reset() { *m = BallotListForHeight{} }
func (m *BallotListForHeight) String() string { return proto.CompactTextString(m) }
func (*BallotListForHeight) ProtoMessage() {}
func (*BallotListForHeight) Descriptor() ([]byte, []int) {
return fileDescriptor_9eac86b249c97b5b, []int{1}
}
func (m *BallotListForHeight) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *BallotListForHeight) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_BallotListForHeight.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *BallotListForHeight) XXX_Merge(src proto.Message) {
xxx_messageInfo_BallotListForHeight.Merge(m, src)
}
func (m *BallotListForHeight) XXX_Size() int {
return m.Size()
}
func (m *BallotListForHeight) XXX_DiscardUnknown() {
xxx_messageInfo_BallotListForHeight.DiscardUnknown(m)
}
var xxx_messageInfo_BallotListForHeight proto.InternalMessageInfo
func (m *BallotListForHeight) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
func (m *BallotListForHeight) GetBallotsIndexList() []string {
if m != nil {
return m.BallotsIndexList
}
return nil
}
func init() {
proto.RegisterEnum("zetachain.zetacore.observer.VoteType", VoteType_name, VoteType_value)
proto.RegisterEnum("zetachain.zetacore.observer.BallotStatus", BallotStatus_name, BallotStatus_value)
proto.RegisterType((*Ballot)(nil), "zetachain.zetacore.observer.Ballot")
proto.RegisterType((*BallotListForHeight)(nil), "zetachain.zetacore.observer.BallotListForHeight")
}
func init() { proto.RegisterFile("observer/ballot.proto", fileDescriptor_9eac86b249c97b5b) }
var fileDescriptor_9eac86b249c97b5b = []byte{
// 537 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xc1, 0x6e, 0xd3, 0x40,
0x10, 0x8d, 0x93, 0x26, 0x34, 0x43, 0x69, 0xc2, 0x12, 0x82, 0x15, 0x84, 0x1b, 0x45, 0xa2, 0x0a,
0xa5, 0xb5, 0xa5, 0xc2, 0x8d, 0x5b, 0x40, 0x11, 0x91, 0x50, 0x01, 0xb7, 0x02, 0x15, 0x0e, 0x96,
0x63, 0x0f, 0xf1, 0x0a, 0xd7, 0x1b, 0xed, 0x6e, 0xaa, 0x36, 0x5f, 0xc1, 0x47, 0x70, 0xe0, 0x53,
0x7a, 0xec, 0x11, 0x71, 0xa8, 0x20, 0xf9, 0x11, 0xe4, 0x5d, 0x3b, 0x04, 0x29, 0xca, 0xc9, 0x3b,
0xf3, 0xe6, 0xbd, 0xd9, 0x9d, 0x37, 0x86, 0xfb, 0x6c, 0x28, 0x90, 0x9f, 0x23, 0x77, 0x86, 0x7e,
0x1c, 0x33, 0x69, 0x8f, 0x39, 0x93, 0x8c, 0x3c, 0x9c, 0xa2, 0xf4, 0x83, 0xc8, 0xa7, 0x89, 0xad,
0x4e, 0x8c, 0xa3, 0x9d, 0x57, 0xb6, 0x1a, 0x23, 0x36, 0x62, 0xaa, 0xce, 0x49, 0x4f, 0x9a, 0xd2,
0x7a, 0xb0, 0x50, 0xca, 0x0f, 0x1a, 0xe8, 0xfc, 0x29, 0x41, 0xa5, 0xa7, 0xc4, 0x49, 0x03, 0xca,
0x34, 0x09, 0xf1, 0xc2, 0x34, 0xda, 0x46, 0xb7, 0xea, 0xea, 0x80, 0x3c, 0x85, 0xbb, 0xba, 0xb9,
0x47, 0x43, 0x4c, 0x24, 0xfd, 0x42, 0x91, 0x9b, 0x45, 0x55, 0x51, 0xd7, 0xc0, 0x60, 0x91, 0x27,
0x8f, 0x00, 0xce, 0x99, 0x44, 0xee, 0xc5, 0x54, 0x48, 0xb3, 0xd4, 0x2e, 0x75, 0xab, 0x6e, 0x55,
0x65, 0xde, 0x50, 0x21, 0xc9, 0x0b, 0x28, 0xa7, 0x81, 0x30, 0x37, 0xda, 0xa5, 0xee, 0xf6, 0xe1,
0x63, 0x7b, 0xcd, 0x43, 0xec, 0x0f, 0x4c, 0xe2, 0xc9, 0xe5, 0x18, 0x5d, 0xcd, 0x21, 0x1f, 0xa1,
0xae, 0x31, 0x5f, 0x52, 0x96, 0x78, 0xf2, 0x72, 0x8c, 0x66, 0xb9, 0x6d, 0x74, 0xb7, 0x0f, 0xf7,
0xd7, 0xea, 0xbc, 0xfd, 0x47, 0x52, 0x72, 0x35, 0xf6, 0x7f, 0x82, 0x9c, 0x42, 0xf6, 0x10, 0x4f,
0x46, 0x1c, 0x45, 0xc4, 0xe2, 0xd0, 0xac, 0xa4, 0x0f, 0xec, 0xd9, 0x57, 0x37, 0x3b, 0x85, 0x5f,
0x37, 0x3b, 0xbb, 0x23, 0x2a, 0xa3, 0xc9, 0xd0, 0x0e, 0xd8, 0x99, 0x13, 0x30, 0x71, 0xc6, 0x44,
0xf6, 0x39, 0x10, 0xe1, 0x57, 0x27, 0xbd, 0x89, 0xb0, 0x5f, 0x61, 0xe0, 0xd6, 0xb4, 0xce, 0x49,
0x2e, 0x43, 0x8e, 0xe0, 0x4e, 0x26, 0x2d, 0xa4, 0x2f, 0x27, 0xc2, 0xbc, 0xa5, 0x2e, 0xfc, 0x64,
0xed, 0x85, 0xb5, 0x1d, 0xc7, 0x8a, 0xe0, 0x6e, 0x0d, 0x97, 0x22, 0xf2, 0x1c, 0x9a, 0x99, 0x5e,
0xc0, 0x51, 0xcf, 0x21, 0x42, 0x3a, 0x8a, 0xa4, 0xb9, 0xd9, 0x36, 0xba, 0x25, 0xb7, 0xa1, 0xd1,
0x97, 0x19, 0xf8, 0x5a, 0x61, 0x9d, 0xcf, 0x70, 0x4f, 0x6b, 0xa6, 0x26, 0xf4, 0x19, 0xd7, 0x69,
0xd2, 0x84, 0x4a, 0x46, 0x36, 0x14, 0x39, 0x8b, 0xc8, 0x3e, 0x10, 0x2d, 0x23, 0x3c, 0xb5, 0x02,
0xda, 0xcc, 0xa2, 0x32, 0x33, 0x9b, 0x94, 0x18, 0xa4, 0x40, 0x2a, 0xb7, 0xf7, 0x1e, 0x36, 0x73,
0xa7, 0x48, 0x13, 0xc8, 0xf1, 0x24, 0x08, 0x50, 0x88, 0xa5, 0xa1, 0xd7, 0x0b, 0x69, 0xbe, 0xef,
0xd3, 0x78, 0xc2, 0x71, 0x39, 0x6f, 0x90, 0x1a, 0xdc, 0x3e, 0x62, 0xf2, 0x14, 0x65, 0xaa, 0x10,
0xd6, 0x8b, 0xad, 0x8d, 0x1f, 0xdf, 0x2d, 0x63, 0x6f, 0x0a, 0x5b, 0xcb, 0x33, 0x20, 0xbb, 0xd0,
0xd1, 0x71, 0x9f, 0x26, 0x7e, 0x4c, 0xa7, 0x18, 0x7a, 0x2b, 0xdb, 0xac, 0xa8, 0x5b, 0xd9, 0xb6,
0x01, 0x75, 0x5d, 0x37, 0x48, 0xde, 0x71, 0x36, 0xe2, 0x28, 0x44, 0xde, 0xbb, 0x37, 0xb8, 0x9a,
0x59, 0xc6, 0xf5, 0xcc, 0x32, 0x7e, 0xcf, 0x2c, 0xe3, 0xdb, 0xdc, 0x2a, 0x5c, 0xcf, 0xad, 0xc2,
0xcf, 0xb9, 0x55, 0xf8, 0xe4, 0x2c, 0x2d, 0x41, 0x6a, 0xda, 0x81, 0xf2, 0xcf, 0xc9, 0xfd, 0x73,
0x2e, 0x16, 0xbf, 0x96, 0xde, 0x88, 0x61, 0x45, 0xfd, 0x61, 0xcf, 0xfe, 0x06, 0x00, 0x00, 0xff,
0xff, 0xd6, 0xe7, 0x98, 0x67, 0xc6, 0x03, 0x00, 0x00,
}
func (m *Ballot) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Ballot) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Ballot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BallotCreationHeight != 0 {
i = encodeVarintBallot(dAtA, i, uint64(m.BallotCreationHeight))
i--
dAtA[i] = 0x40
}
if m.BallotStatus != 0 {
i = encodeVarintBallot(dAtA, i, uint64(m.BallotStatus))
i--
dAtA[i] = 0x38
}
{
size := m.BallotThreshold.Size()
i -= size
if _, err := m.BallotThreshold.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintBallot(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if m.ObservationType != 0 {
i = encodeVarintBallot(dAtA, i, uint64(m.ObservationType))
i--
dAtA[i] = 0x28
}
if len(m.Votes) > 0 {
dAtA2 := make([]byte, len(m.Votes)*10)
var j1 int
for _, num := range m.Votes {
for num >= 1<<7 {
dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j1++
}
dAtA2[j1] = uint8(num)
j1++
}
i -= j1
copy(dAtA[i:], dAtA2[:j1])
i = encodeVarintBallot(dAtA, i, uint64(j1))
i--
dAtA[i] = 0x22
}
if len(m.VoterList) > 0 {
for iNdEx := len(m.VoterList) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.VoterList[iNdEx])
copy(dAtA[i:], m.VoterList[iNdEx])
i = encodeVarintBallot(dAtA, i, uint64(len(m.VoterList[iNdEx])))
i--
dAtA[i] = 0x1a
}
}
if len(m.BallotIdentifier) > 0 {
i -= len(m.BallotIdentifier)
copy(dAtA[i:], m.BallotIdentifier)
i = encodeVarintBallot(dAtA, i, uint64(len(m.BallotIdentifier)))
i--
dAtA[i] = 0x12
}
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintBallot(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *BallotListForHeight) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *BallotListForHeight) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *BallotListForHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BallotsIndexList) > 0 {
for iNdEx := len(m.BallotsIndexList) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.BallotsIndexList[iNdEx])
copy(dAtA[i:], m.BallotsIndexList[iNdEx])
i = encodeVarintBallot(dAtA, i, uint64(len(m.BallotsIndexList[iNdEx])))
i--
dAtA[i] = 0x12
}
}
if m.Height != 0 {
i = encodeVarintBallot(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintBallot(dAtA []byte, offset int, v uint64) int {
offset -= sovBallot(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Ballot) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovBallot(uint64(l))
}
l = len(m.BallotIdentifier)
if l > 0 {
n += 1 + l + sovBallot(uint64(l))
}
if len(m.VoterList) > 0 {
for _, s := range m.VoterList {
l = len(s)
n += 1 + l + sovBallot(uint64(l))
}
}
if len(m.Votes) > 0 {
l = 0
for _, e := range m.Votes {
l += sovBallot(uint64(e))
}
n += 1 + sovBallot(uint64(l)) + l
}
if m.ObservationType != 0 {
n += 1 + sovBallot(uint64(m.ObservationType))
}
l = m.BallotThreshold.Size()
n += 1 + l + sovBallot(uint64(l))
if m.BallotStatus != 0 {
n += 1 + sovBallot(uint64(m.BallotStatus))
}
if m.BallotCreationHeight != 0 {
n += 1 + sovBallot(uint64(m.BallotCreationHeight))
}
return n
}
func (m *BallotListForHeight) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovBallot(uint64(m.Height))
}
if len(m.BallotsIndexList) > 0 {
for _, s := range m.BallotsIndexList {
l = len(s)
n += 1 + l + sovBallot(uint64(l))
}
}
return n
}
func sovBallot(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozBallot(x uint64) (n int) {
return sovBallot(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Ballot) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Ballot: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Ballot: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBallot
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBallot
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBallot
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBallot
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field VoterList", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBallot
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBallot
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.VoterList = append(m.VoterList, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 4:
if wireType == 0 {
var v VoteType
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= VoteType(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Votes = append(m.Votes, v)
} else if wireType == 2 {
var packedLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
packedLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if packedLen < 0 {
return ErrInvalidLengthBallot
}
postIndex := iNdEx + packedLen
if postIndex < 0 {
return ErrInvalidLengthBallot
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
var elementCount int
if elementCount != 0 && len(m.Votes) == 0 {
m.Votes = make([]VoteType, 0, elementCount)
}
for iNdEx < postIndex {
var v VoteType
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= VoteType(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Votes = append(m.Votes, v)
}
} else {
return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType)
}
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservationType", wireType)
}
m.ObservationType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ObservationType |= ObservationType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotThreshold", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBallot
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBallot
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.BallotThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotStatus", wireType)
}
m.BallotStatus = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BallotStatus |= BallotStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotCreationHeight", wireType)
}
m.BallotCreationHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BallotCreationHeight |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipBallot(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthBallot
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *BallotListForHeight) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: BallotListForHeight: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: BallotListForHeight: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotsIndexList", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBallot
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBallot
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBallot
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BallotsIndexList = append(m.BallotsIndexList, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipBallot(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthBallot
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipBallot(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowBallot
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowBallot
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowBallot
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthBallot
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupBallot
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthBallot
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthBallot = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowBallot = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupBallot = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/blame.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Node struct {
PubKey string `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"`
BlameData []byte `protobuf:"bytes,2,opt,name=blame_data,json=blameData,proto3" json:"blame_data,omitempty"`
BlameSignature []byte `protobuf:"bytes,3,opt,name=blame_signature,json=blameSignature,proto3" json:"blame_signature,omitempty"`
}
func (m *Node) Reset() { *m = Node{} }
func (m *Node) String() string { return proto.CompactTextString(m) }
func (*Node) ProtoMessage() {}
func (*Node) Descriptor() ([]byte, []int) {
return fileDescriptor_e9eda3a934f0dc78, []int{0}
}
func (m *Node) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Node.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Node) XXX_Merge(src proto.Message) {
xxx_messageInfo_Node.Merge(m, src)
}
func (m *Node) XXX_Size() int {
return m.Size()
}
func (m *Node) XXX_DiscardUnknown() {
xxx_messageInfo_Node.DiscardUnknown(m)
}
var xxx_messageInfo_Node proto.InternalMessageInfo
func (m *Node) GetPubKey() string {
if m != nil {
return m.PubKey
}
return ""
}
func (m *Node) GetBlameData() []byte {
if m != nil {
return m.BlameData
}
return nil
}
func (m *Node) GetBlameSignature() []byte {
if m != nil {
return m.BlameSignature
}
return nil
}
type Blame struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
FailureReason string `protobuf:"bytes,2,opt,name=failure_reason,json=failureReason,proto3" json:"failure_reason,omitempty"`
Nodes []*Node `protobuf:"bytes,3,rep,name=nodes,proto3" json:"nodes,omitempty"`
}
func (m *Blame) Reset() { *m = Blame{} }
func (m *Blame) String() string { return proto.CompactTextString(m) }
func (*Blame) ProtoMessage() {}
func (*Blame) Descriptor() ([]byte, []int) {
return fileDescriptor_e9eda3a934f0dc78, []int{1}
}
func (m *Blame) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Blame) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Blame.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Blame) XXX_Merge(src proto.Message) {
xxx_messageInfo_Blame.Merge(m, src)
}
func (m *Blame) XXX_Size() int {
return m.Size()
}
func (m *Blame) XXX_DiscardUnknown() {
xxx_messageInfo_Blame.DiscardUnknown(m)
}
var xxx_messageInfo_Blame proto.InternalMessageInfo
func (m *Blame) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *Blame) GetFailureReason() string {
if m != nil {
return m.FailureReason
}
return ""
}
func (m *Blame) GetNodes() []*Node {
if m != nil {
return m.Nodes
}
return nil
}
func init() {
proto.RegisterType((*Node)(nil), "zetachain.zetacore.observer.Node")
proto.RegisterType((*Blame)(nil), "zetachain.zetacore.observer.Blame")
}
func init() { proto.RegisterFile("observer/blame.proto", fileDescriptor_e9eda3a934f0dc78) }
var fileDescriptor_e9eda3a934f0dc78 = []byte{
// 292 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xc1, 0x4b, 0xc3, 0x30,
0x14, 0xc6, 0x17, 0xe7, 0x26, 0x8d, 0x3a, 0x21, 0x0c, 0x56, 0x14, 0x43, 0x1d, 0x88, 0xbd, 0x98,
0x80, 0x1e, 0xbc, 0x0f, 0x2f, 0x22, 0x78, 0xa8, 0x37, 0x2f, 0x25, 0x59, 0x9f, 0x5d, 0x71, 0x6b,
0x4a, 0x9a, 0xca, 0x2a, 0xf8, 0x3f, 0xf8, 0x67, 0x79, 0xdc, 0xd1, 0xa3, 0xb4, 0xff, 0x88, 0x34,
0x5d, 0x77, 0xf4, 0xf6, 0xf2, 0xcb, 0xf7, 0xbe, 0x8f, 0xf7, 0xe1, 0xb1, 0x92, 0x39, 0xe8, 0x77,
0xd0, 0x5c, 0x2e, 0xc5, 0x0a, 0x58, 0xa6, 0x95, 0x51, 0xe4, 0xec, 0x03, 0x8c, 0x98, 0x2f, 0x44,
0x92, 0x32, 0x3b, 0x29, 0x0d, 0xac, 0x13, 0x9e, 0x4e, 0x76, 0x2b, 0xdd, 0xd0, 0x6e, 0x4d, 0x63,
0xbc, 0xff, 0xa4, 0x22, 0x20, 0x13, 0x7c, 0x90, 0x15, 0x32, 0x7c, 0x83, 0xd2, 0x45, 0x1e, 0xf2,
0x9d, 0x60, 0x98, 0x15, 0xf2, 0x11, 0x4a, 0x72, 0x8e, 0xb1, 0x4d, 0x09, 0x23, 0x61, 0x84, 0xbb,
0xe7, 0x21, 0xff, 0x28, 0x70, 0x2c, 0xb9, 0x17, 0x46, 0x90, 0x2b, 0x7c, 0xd2, 0x7e, 0xe7, 0x49,
0x9c, 0x0a, 0x53, 0x68, 0x70, 0xfb, 0x56, 0x33, 0xb2, 0xf8, 0xb9, 0xa3, 0xd3, 0x4f, 0x3c, 0x98,
0x35, 0x84, 0x8c, 0xf1, 0x20, 0x49, 0x23, 0x58, 0x6f, 0x73, 0xda, 0x07, 0xb9, 0xc4, 0xa3, 0x57,
0x91, 0x2c, 0x0b, 0x0d, 0xa1, 0x06, 0x91, 0xab, 0xd4, 0x46, 0x39, 0xc1, 0xf1, 0x96, 0x06, 0x16,
0x92, 0x3b, 0x3c, 0x48, 0x55, 0x04, 0xb9, 0xdb, 0xf7, 0xfa, 0xfe, 0xe1, 0xcd, 0x05, 0xfb, 0xe7,
0x68, 0xd6, 0x1c, 0x16, 0xb4, 0xfa, 0xd9, 0xc3, 0x77, 0x45, 0xd1, 0xa6, 0xa2, 0xe8, 0xb7, 0xa2,
0xe8, 0xab, 0xa6, 0xbd, 0x4d, 0x4d, 0x7b, 0x3f, 0x35, 0xed, 0xbd, 0xf0, 0x38, 0x31, 0x8b, 0x42,
0xb2, 0xb9, 0x5a, 0xf1, 0xc6, 0xe3, 0xda, 0xda, 0xf1, 0xce, 0x8e, 0xaf, 0x77, 0x95, 0x71, 0x53,
0x66, 0x90, 0xcb, 0xa1, 0x6d, 0xee, 0xf6, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x5e, 0x43, 0xc9,
0x87, 0x01, 0x00, 0x00,
}
func (m *Node) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Node) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BlameSignature) > 0 {
i -= len(m.BlameSignature)
copy(dAtA[i:], m.BlameSignature)
i = encodeVarintBlame(dAtA, i, uint64(len(m.BlameSignature)))
i--
dAtA[i] = 0x1a
}
if len(m.BlameData) > 0 {
i -= len(m.BlameData)
copy(dAtA[i:], m.BlameData)
i = encodeVarintBlame(dAtA, i, uint64(len(m.BlameData)))
i--
dAtA[i] = 0x12
}
if len(m.PubKey) > 0 {
i -= len(m.PubKey)
copy(dAtA[i:], m.PubKey)
i = encodeVarintBlame(dAtA, i, uint64(len(m.PubKey)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Blame) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Blame) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Blame) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Nodes) > 0 {
for iNdEx := len(m.Nodes) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Nodes[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintBlame(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
}
if len(m.FailureReason) > 0 {
i -= len(m.FailureReason)
copy(dAtA[i:], m.FailureReason)
i = encodeVarintBlame(dAtA, i, uint64(len(m.FailureReason)))
i--
dAtA[i] = 0x12
}
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintBlame(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintBlame(dAtA []byte, offset int, v uint64) int {
offset -= sovBlame(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Node) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.PubKey)
if l > 0 {
n += 1 + l + sovBlame(uint64(l))
}
l = len(m.BlameData)
if l > 0 {
n += 1 + l + sovBlame(uint64(l))
}
l = len(m.BlameSignature)
if l > 0 {
n += 1 + l + sovBlame(uint64(l))
}
return n
}
func (m *Blame) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovBlame(uint64(l))
}
l = len(m.FailureReason)
if l > 0 {
n += 1 + l + sovBlame(uint64(l))
}
if len(m.Nodes) > 0 {
for _, e := range m.Nodes {
l = e.Size()
n += 1 + l + sovBlame(uint64(l))
}
}
return n
}
func sovBlame(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozBlame(x uint64) (n int) {
return sovBlame(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Node) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Node: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBlame
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBlame
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PubKey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlameData", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthBlame
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthBlame
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlameData = append(m.BlameData[:0], dAtA[iNdEx:postIndex]...)
if m.BlameData == nil {
m.BlameData = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlameSignature", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthBlame
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthBlame
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlameSignature = append(m.BlameSignature[:0], dAtA[iNdEx:postIndex]...)
if m.BlameSignature == nil {
m.BlameSignature = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipBlame(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthBlame
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Blame) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Blame: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Blame: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBlame
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBlame
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FailureReason", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthBlame
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthBlame
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FailureReason = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Nodes", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlame
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthBlame
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthBlame
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Nodes = append(m.Nodes, &Node{})
if err := m.Nodes[len(m.Nodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipBlame(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthBlame
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipBlame(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowBlame
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowBlame
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowBlame
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthBlame
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupBlame
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthBlame
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthBlame = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowBlame = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupBlame = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgAddObserver{}, "observer/AddObserver", nil)
cdc.RegisterConcrete(&MsgUpdateCoreParams{}, "observer/UpdateCoreParam", nil)
cdc.RegisterConcrete(&MsgAddBlameVote{}, "crosschain/AddBlameVote", nil)
cdc.RegisterConcrete(&MsgUpdateCrosschainFlags{}, "crosschain/UpdateCrosschainFlags", nil)
cdc.RegisterConcrete(&MsgUpdateKeygen{}, "crosschain/UpdateKeygen", nil)
cdc.RegisterConcrete(&MsgAddBlockHeader{}, "crosschain/AddBlockHeader", nil)
}
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgAddObserver{},
&MsgUpdateCoreParams{},
&MsgAddBlameVote{},
&MsgUpdateCrosschainFlags{},
&MsgUpdateKeygen{},
&MsgAddBlockHeader{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
var (
Amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
)
//go:build TESTNET
// +build TESTNET
package types
import (
"fmt"
"github.com/coinbase/rosetta-sdk-go/types"
"github.com/zeta-chain/zetacore/common"
)
func GetCoreParams() CoreParamsList {
params := CoreParamsList{
CoreParams: []*CoreParams{
{
ChainId: common.GoerliChain().ChainId,
ConfirmationCount: 6,
// This is the actual Zeta token Goerli testnet, we need to specify this address for the integration tests to pass
ZetaTokenContractAddress: "0x0000c304d2934c00db1d51995b9f6996affd17c0",
ConnectorContractAddress: "",
Erc20CustodyContractAddress: "",
InTxTicker: 12,
OutTxTicker: 15,
WatchUtxoTicker: 0,
GasPriceTicker: 30,
OutboundTxScheduleInterval: 30,
OutboundTxScheduleLookahead: 60,
},
{
ChainId: common.BscTestnetChain().ChainId,
ConfirmationCount: 6,
ZetaTokenContractAddress: "",
ConnectorContractAddress: "",
Erc20CustodyContractAddress: "",
InTxTicker: 5,
OutTxTicker: 15,
WatchUtxoTicker: 0,
GasPriceTicker: 30,
OutboundTxScheduleInterval: 30,
OutboundTxScheduleLookahead: 60,
},
{
ChainId: common.MumbaiChain().ChainId,
ConfirmationCount: 12,
ZetaTokenContractAddress: "",
ConnectorContractAddress: "",
Erc20CustodyContractAddress: "",
InTxTicker: 2,
OutTxTicker: 15,
WatchUtxoTicker: 0,
GasPriceTicker: 30,
OutboundTxScheduleInterval: 30,
OutboundTxScheduleLookahead: 60,
},
{
ChainId: common.BtcTestNetChain().ChainId,
ConfirmationCount: 2,
ZetaTokenContractAddress: "",
ConnectorContractAddress: "",
Erc20CustodyContractAddress: "",
WatchUtxoTicker: 30,
InTxTicker: 120,
OutTxTicker: 12,
GasPriceTicker: 30,
OutboundTxScheduleInterval: 30,
OutboundTxScheduleLookahead: 100,
},
},
}
chainList := common.ExternalChainList()
requiredParams := len(chainList)
availableParams := 0
for _, chain := range chainList {
for _, param := range params.CoreParams {
if chain.ChainId == param.ChainId {
availableParams++
}
}
}
if availableParams != requiredParams {
panic(fmt.Sprintf("Core params are not available for all chains , DefaultChains : %s , CoreParams : %s",
types.PrettyPrintStruct(chainList), params.String()))
}
return params
}
package types
import "time"
var DefaultGasPriceIncreaseFlags = GasPriceIncreaseFlags{
// EpochLength is the number of blocks in an epoch before triggering a gas price increase
EpochLength: 100,
// RetryInterval is the number of blocks to wait before incrementing the gas price again
RetryInterval: time.Minute * 10,
// GasPriceIncreasePercent is the percentage of median gas price by which to increase the gas price during an increment
// 100 means the gas price is increased by the median gas price
GasPriceIncreasePercent: 100,
// Maximum gas price increase in percent of the median gas price
// 500 means the gas price can be increased by 5 times the median gas price at most
GasPriceIncreaseMax: 500,
}
var DefaultBlockHeaderVerificationFlags = BlockHeaderVerificationFlags{
IsEthTypeChainEnabled: true,
IsBtcTypeChainEnabled: true,
}
// DefaultCrosschainFlags returns the default crosschain flags used when not defined
func DefaultCrosschainFlags() *CrosschainFlags {
return &CrosschainFlags{
IsInboundEnabled: true,
IsOutboundEnabled: true,
GasPriceIncreaseFlags: &DefaultGasPriceIncreaseFlags,
BlockHeaderVerificationFlags: &DefaultBlockHeaderVerificationFlags,
}
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/crosschain_flags.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
time "time"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
_ "google.golang.org/protobuf/types/known/durationpb"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type GasPriceIncreaseFlags struct {
EpochLength int64 `protobuf:"varint,1,opt,name=epochLength,proto3" json:"epochLength,omitempty"`
RetryInterval time.Duration `protobuf:"bytes,2,opt,name=retryInterval,proto3,stdduration" json:"retryInterval"`
GasPriceIncreasePercent uint32 `protobuf:"varint,3,opt,name=gasPriceIncreasePercent,proto3" json:"gasPriceIncreasePercent,omitempty"`
// Maximum gas price increase in percent of the median gas price
// Default is used if 0
GasPriceIncreaseMax uint32 `protobuf:"varint,4,opt,name=gasPriceIncreaseMax,proto3" json:"gasPriceIncreaseMax,omitempty"`
}
func (m *GasPriceIncreaseFlags) Reset() { *m = GasPriceIncreaseFlags{} }
func (m *GasPriceIncreaseFlags) String() string { return proto.CompactTextString(m) }
func (*GasPriceIncreaseFlags) ProtoMessage() {}
func (*GasPriceIncreaseFlags) Descriptor() ([]byte, []int) {
return fileDescriptor_b948b59e4d986f49, []int{0}
}
func (m *GasPriceIncreaseFlags) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GasPriceIncreaseFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GasPriceIncreaseFlags.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GasPriceIncreaseFlags) XXX_Merge(src proto.Message) {
xxx_messageInfo_GasPriceIncreaseFlags.Merge(m, src)
}
func (m *GasPriceIncreaseFlags) XXX_Size() int {
return m.Size()
}
func (m *GasPriceIncreaseFlags) XXX_DiscardUnknown() {
xxx_messageInfo_GasPriceIncreaseFlags.DiscardUnknown(m)
}
var xxx_messageInfo_GasPriceIncreaseFlags proto.InternalMessageInfo
func (m *GasPriceIncreaseFlags) GetEpochLength() int64 {
if m != nil {
return m.EpochLength
}
return 0
}
func (m *GasPriceIncreaseFlags) GetRetryInterval() time.Duration {
if m != nil {
return m.RetryInterval
}
return 0
}
func (m *GasPriceIncreaseFlags) GetGasPriceIncreasePercent() uint32 {
if m != nil {
return m.GasPriceIncreasePercent
}
return 0
}
func (m *GasPriceIncreaseFlags) GetGasPriceIncreaseMax() uint32 {
if m != nil {
return m.GasPriceIncreaseMax
}
return 0
}
type BlockHeaderVerificationFlags struct {
IsEthTypeChainEnabled bool `protobuf:"varint,1,opt,name=isEthTypeChainEnabled,proto3" json:"isEthTypeChainEnabled,omitempty"`
IsBtcTypeChainEnabled bool `protobuf:"varint,2,opt,name=isBtcTypeChainEnabled,proto3" json:"isBtcTypeChainEnabled,omitempty"`
}
func (m *BlockHeaderVerificationFlags) Reset() { *m = BlockHeaderVerificationFlags{} }
func (m *BlockHeaderVerificationFlags) String() string { return proto.CompactTextString(m) }
func (*BlockHeaderVerificationFlags) ProtoMessage() {}
func (*BlockHeaderVerificationFlags) Descriptor() ([]byte, []int) {
return fileDescriptor_b948b59e4d986f49, []int{1}
}
func (m *BlockHeaderVerificationFlags) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *BlockHeaderVerificationFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_BlockHeaderVerificationFlags.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *BlockHeaderVerificationFlags) XXX_Merge(src proto.Message) {
xxx_messageInfo_BlockHeaderVerificationFlags.Merge(m, src)
}
func (m *BlockHeaderVerificationFlags) XXX_Size() int {
return m.Size()
}
func (m *BlockHeaderVerificationFlags) XXX_DiscardUnknown() {
xxx_messageInfo_BlockHeaderVerificationFlags.DiscardUnknown(m)
}
var xxx_messageInfo_BlockHeaderVerificationFlags proto.InternalMessageInfo
func (m *BlockHeaderVerificationFlags) GetIsEthTypeChainEnabled() bool {
if m != nil {
return m.IsEthTypeChainEnabled
}
return false
}
func (m *BlockHeaderVerificationFlags) GetIsBtcTypeChainEnabled() bool {
if m != nil {
return m.IsBtcTypeChainEnabled
}
return false
}
type CrosschainFlags struct {
IsInboundEnabled bool `protobuf:"varint,1,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
IsOutboundEnabled bool `protobuf:"varint,2,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,3,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"`
BlockHeaderVerificationFlags *BlockHeaderVerificationFlags `protobuf:"bytes,4,opt,name=blockHeaderVerificationFlags,proto3" json:"blockHeaderVerificationFlags,omitempty"`
}
func (m *CrosschainFlags) Reset() { *m = CrosschainFlags{} }
func (m *CrosschainFlags) String() string { return proto.CompactTextString(m) }
func (*CrosschainFlags) ProtoMessage() {}
func (*CrosschainFlags) Descriptor() ([]byte, []int) {
return fileDescriptor_b948b59e4d986f49, []int{2}
}
func (m *CrosschainFlags) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *CrosschainFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_CrosschainFlags.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *CrosschainFlags) XXX_Merge(src proto.Message) {
xxx_messageInfo_CrosschainFlags.Merge(m, src)
}
func (m *CrosschainFlags) XXX_Size() int {
return m.Size()
}
func (m *CrosschainFlags) XXX_DiscardUnknown() {
xxx_messageInfo_CrosschainFlags.DiscardUnknown(m)
}
var xxx_messageInfo_CrosschainFlags proto.InternalMessageInfo
func (m *CrosschainFlags) GetIsInboundEnabled() bool {
if m != nil {
return m.IsInboundEnabled
}
return false
}
func (m *CrosschainFlags) GetIsOutboundEnabled() bool {
if m != nil {
return m.IsOutboundEnabled
}
return false
}
func (m *CrosschainFlags) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags {
if m != nil {
return m.GasPriceIncreaseFlags
}
return nil
}
func (m *CrosschainFlags) GetBlockHeaderVerificationFlags() *BlockHeaderVerificationFlags {
if m != nil {
return m.BlockHeaderVerificationFlags
}
return nil
}
type LegacyCrosschainFlags struct {
IsInboundEnabled bool `protobuf:"varint,1,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
IsOutboundEnabled bool `protobuf:"varint,2,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,3,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"`
}
func (m *LegacyCrosschainFlags) Reset() { *m = LegacyCrosschainFlags{} }
func (m *LegacyCrosschainFlags) String() string { return proto.CompactTextString(m) }
func (*LegacyCrosschainFlags) ProtoMessage() {}
func (*LegacyCrosschainFlags) Descriptor() ([]byte, []int) {
return fileDescriptor_b948b59e4d986f49, []int{3}
}
func (m *LegacyCrosschainFlags) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LegacyCrosschainFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LegacyCrosschainFlags.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LegacyCrosschainFlags) XXX_Merge(src proto.Message) {
xxx_messageInfo_LegacyCrosschainFlags.Merge(m, src)
}
func (m *LegacyCrosschainFlags) XXX_Size() int {
return m.Size()
}
func (m *LegacyCrosschainFlags) XXX_DiscardUnknown() {
xxx_messageInfo_LegacyCrosschainFlags.DiscardUnknown(m)
}
var xxx_messageInfo_LegacyCrosschainFlags proto.InternalMessageInfo
func (m *LegacyCrosschainFlags) GetIsInboundEnabled() bool {
if m != nil {
return m.IsInboundEnabled
}
return false
}
func (m *LegacyCrosschainFlags) GetIsOutboundEnabled() bool {
if m != nil {
return m.IsOutboundEnabled
}
return false
}
func (m *LegacyCrosschainFlags) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags {
if m != nil {
return m.GasPriceIncreaseFlags
}
return nil
}
func init() {
proto.RegisterType((*GasPriceIncreaseFlags)(nil), "zetachain.zetacore.observer.GasPriceIncreaseFlags")
proto.RegisterType((*BlockHeaderVerificationFlags)(nil), "zetachain.zetacore.observer.BlockHeaderVerificationFlags")
proto.RegisterType((*CrosschainFlags)(nil), "zetachain.zetacore.observer.CrosschainFlags")
proto.RegisterType((*LegacyCrosschainFlags)(nil), "zetachain.zetacore.observer.LegacyCrosschainFlags")
}
func init() { proto.RegisterFile("observer/crosschain_flags.proto", fileDescriptor_b948b59e4d986f49) }
var fileDescriptor_b948b59e4d986f49 = []byte{
// 468 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0xc1, 0x6e, 0xd3, 0x30,
0x18, 0xc7, 0xeb, 0x0e, 0xa1, 0xc9, 0xd5, 0x04, 0x04, 0x2a, 0xca, 0x98, 0xd2, 0xaa, 0xa7, 0x0a,
0x81, 0x8d, 0x0a, 0x07, 0xb8, 0x76, 0x0c, 0x88, 0x34, 0xc4, 0x14, 0x21, 0x0e, 0x5c, 0x90, 0xe3,
0x7e, 0x75, 0x2c, 0x82, 0x5d, 0xd9, 0xce, 0xb4, 0x22, 0xf1, 0x02, 0x9c, 0x38, 0xf2, 0x48, 0x3b,
0xee, 0xc0, 0x01, 0x09, 0x09, 0x50, 0xfb, 0x02, 0x3c, 0x02, 0xaa, 0x43, 0x26, 0xda, 0x86, 0x3c,
0xc0, 0x6e, 0xce, 0xf7, 0xf7, 0xdf, 0x3f, 0xe7, 0xff, 0x7d, 0x09, 0xee, 0xea, 0xc4, 0x82, 0x39,
0x06, 0x43, 0xb9, 0xd1, 0xd6, 0xf2, 0x94, 0x49, 0xf5, 0x76, 0x92, 0x31, 0x61, 0xc9, 0xd4, 0x68,
0xa7, 0x83, 0xdb, 0x1f, 0xc0, 0x31, 0x5f, 0x26, 0x7e, 0xa5, 0x0d, 0x90, 0xd2, 0xb3, 0x7b, 0x43,
0x68, 0xa1, 0xfd, 0x3e, 0xba, 0x5c, 0x15, 0x96, 0xdd, 0x50, 0x68, 0x2d, 0x32, 0xa0, 0xfe, 0x29,
0xc9, 0x27, 0x74, 0x9c, 0x1b, 0xe6, 0xa4, 0x56, 0x85, 0xde, 0xff, 0x8d, 0x70, 0xfb, 0x19, 0xb3,
0x47, 0x46, 0x72, 0x88, 0x14, 0x37, 0xc0, 0x2c, 0x3c, 0x5d, 0x22, 0x83, 0x1e, 0x6e, 0xc1, 0x54,
0xf3, 0xf4, 0x10, 0x94, 0x70, 0x69, 0x07, 0xf5, 0xd0, 0x60, 0x2b, 0xfe, 0xb7, 0x14, 0x44, 0x78,
0xc7, 0x80, 0x33, 0xb3, 0x48, 0x39, 0x30, 0xc7, 0x2c, 0xeb, 0x34, 0x7b, 0x68, 0xd0, 0x1a, 0xde,
0x22, 0x05, 0x93, 0x94, 0x4c, 0xf2, 0xe4, 0x2f, 0x73, 0xb4, 0x7d, 0xfa, 0xa3, 0xdb, 0xf8, 0xf2,
0xb3, 0x8b, 0xe2, 0x55, 0x67, 0xf0, 0x08, 0xdf, 0x14, 0x6b, 0xb7, 0x38, 0x02, 0xc3, 0x41, 0xb9,
0xce, 0x56, 0x0f, 0x0d, 0x76, 0xe2, 0xff, 0xc9, 0xc1, 0x7d, 0x7c, 0x7d, 0x5d, 0x7a, 0xc1, 0x4e,
0x3a, 0x97, 0xbc, 0xab, 0x4a, 0xea, 0x7f, 0x42, 0x78, 0x6f, 0x94, 0x69, 0xfe, 0xee, 0x39, 0xb0,
0x31, 0x98, 0xd7, 0x60, 0xe4, 0x44, 0x72, 0x7f, 0xc1, 0xe2, 0xcd, 0x1f, 0xe2, 0xb6, 0xb4, 0x07,
0x2e, 0x7d, 0x35, 0x9b, 0xc2, 0xfe, 0x32, 0xed, 0x03, 0xc5, 0x92, 0x0c, 0xc6, 0x3e, 0x83, 0xed,
0xb8, 0x5a, 0x2c, 0x5c, 0x23, 0xc7, 0x37, 0x5c, 0xcd, 0xd2, 0x55, 0x21, 0xf6, 0xbf, 0x36, 0xf1,
0x95, 0xfd, 0xf3, 0x6e, 0x17, 0xfc, 0x3b, 0xf8, 0xaa, 0xb4, 0x91, 0x4a, 0x74, 0xae, 0xc6, 0xab,
0xe8, 0x8d, 0x7a, 0x70, 0x17, 0x5f, 0x93, 0xf6, 0x65, 0xee, 0x56, 0x36, 0x17, 0xc4, 0x4d, 0x21,
0x48, 0x71, 0x5b, 0x54, 0x35, 0xdb, 0x87, 0xdc, 0x1a, 0x0e, 0x49, 0xcd, 0x80, 0x91, 0xca, 0x31,
0x89, 0xab, 0x0f, 0x0c, 0x3e, 0xe2, 0xbd, 0xa4, 0x26, 0x63, 0xdf, 0x9f, 0xd6, 0xf0, 0x71, 0x2d,
0xb0, 0xae, 0x49, 0x71, 0xed, 0xf1, 0xfd, 0xef, 0x08, 0xb7, 0x0f, 0x41, 0x30, 0x3e, 0xbb, 0x80,
0xe1, 0x8e, 0xa2, 0xd3, 0x79, 0x88, 0xce, 0xe6, 0x21, 0xfa, 0x35, 0x0f, 0xd1, 0xe7, 0x45, 0xd8,
0x38, 0x5b, 0x84, 0x8d, 0x6f, 0x8b, 0xb0, 0xf1, 0x86, 0x0a, 0xe9, 0xd2, 0x3c, 0x21, 0x5c, 0xbf,
0xa7, 0x4b, 0xc8, 0x3d, 0xcf, 0xa3, 0x25, 0x8f, 0x9e, 0xd0, 0xf3, 0x7f, 0x8c, 0x9b, 0x4d, 0xc1,
0x26, 0x97, 0xfd, 0x47, 0xfa, 0xe0, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xb0, 0x8c, 0xc5,
0x7c, 0x04, 0x00, 0x00,
}
func (m *GasPriceIncreaseFlags) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GasPriceIncreaseFlags) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GasPriceIncreaseFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.GasPriceIncreaseMax != 0 {
i = encodeVarintCrosschainFlags(dAtA, i, uint64(m.GasPriceIncreaseMax))
i--
dAtA[i] = 0x20
}
if m.GasPriceIncreasePercent != 0 {
i = encodeVarintCrosschainFlags(dAtA, i, uint64(m.GasPriceIncreasePercent))
i--
dAtA[i] = 0x18
}
n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.RetryInterval, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.RetryInterval):])
if err1 != nil {
return 0, err1
}
i -= n1
i = encodeVarintCrosschainFlags(dAtA, i, uint64(n1))
i--
dAtA[i] = 0x12
if m.EpochLength != 0 {
i = encodeVarintCrosschainFlags(dAtA, i, uint64(m.EpochLength))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *BlockHeaderVerificationFlags) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *BlockHeaderVerificationFlags) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *BlockHeaderVerificationFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.IsBtcTypeChainEnabled {
i--
if m.IsBtcTypeChainEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
if m.IsEthTypeChainEnabled {
i--
if m.IsEthTypeChainEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *CrosschainFlags) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CrosschainFlags) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CrosschainFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockHeaderVerificationFlags != nil {
{
size, err := m.BlockHeaderVerificationFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCrosschainFlags(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
if m.GasPriceIncreaseFlags != nil {
{
size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCrosschainFlags(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if m.IsOutboundEnabled {
i--
if m.IsOutboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
if m.IsInboundEnabled {
i--
if m.IsInboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *LegacyCrosschainFlags) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *LegacyCrosschainFlags) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LegacyCrosschainFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.GasPriceIncreaseFlags != nil {
{
size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintCrosschainFlags(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if m.IsOutboundEnabled {
i--
if m.IsOutboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
if m.IsInboundEnabled {
i--
if m.IsInboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintCrosschainFlags(dAtA []byte, offset int, v uint64) int {
offset -= sovCrosschainFlags(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GasPriceIncreaseFlags) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.EpochLength != 0 {
n += 1 + sovCrosschainFlags(uint64(m.EpochLength))
}
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.RetryInterval)
n += 1 + l + sovCrosschainFlags(uint64(l))
if m.GasPriceIncreasePercent != 0 {
n += 1 + sovCrosschainFlags(uint64(m.GasPriceIncreasePercent))
}
if m.GasPriceIncreaseMax != 0 {
n += 1 + sovCrosschainFlags(uint64(m.GasPriceIncreaseMax))
}
return n
}
func (m *BlockHeaderVerificationFlags) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.IsEthTypeChainEnabled {
n += 2
}
if m.IsBtcTypeChainEnabled {
n += 2
}
return n
}
func (m *CrosschainFlags) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.IsInboundEnabled {
n += 2
}
if m.IsOutboundEnabled {
n += 2
}
if m.GasPriceIncreaseFlags != nil {
l = m.GasPriceIncreaseFlags.Size()
n += 1 + l + sovCrosschainFlags(uint64(l))
}
if m.BlockHeaderVerificationFlags != nil {
l = m.BlockHeaderVerificationFlags.Size()
n += 1 + l + sovCrosschainFlags(uint64(l))
}
return n
}
func (m *LegacyCrosschainFlags) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.IsInboundEnabled {
n += 2
}
if m.IsOutboundEnabled {
n += 2
}
if m.GasPriceIncreaseFlags != nil {
l = m.GasPriceIncreaseFlags.Size()
n += 1 + l + sovCrosschainFlags(uint64(l))
}
return n
}
func sovCrosschainFlags(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozCrosschainFlags(x uint64) (n int) {
return sovCrosschainFlags(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GasPriceIncreaseFlags) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GasPriceIncreaseFlags: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GasPriceIncreaseFlags: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field EpochLength", wireType)
}
m.EpochLength = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.EpochLength |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RetryInterval", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCrosschainFlags
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCrosschainFlags
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.RetryInterval, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreasePercent", wireType)
}
m.GasPriceIncreasePercent = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasPriceIncreasePercent |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseMax", wireType)
}
m.GasPriceIncreaseMax = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasPriceIncreaseMax |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipCrosschainFlags(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrosschainFlags
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *BlockHeaderVerificationFlags) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: BlockHeaderVerificationFlags: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: BlockHeaderVerificationFlags: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsEthTypeChainEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsEthTypeChainEnabled = bool(v != 0)
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsBtcTypeChainEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsBtcTypeChainEnabled = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipCrosschainFlags(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrosschainFlags
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *CrosschainFlags) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: CrosschainFlags: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: CrosschainFlags: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsInboundEnabled = bool(v != 0)
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsOutboundEnabled = bool(v != 0)
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCrosschainFlags
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCrosschainFlags
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.GasPriceIncreaseFlags == nil {
m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{}
}
if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeaderVerificationFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCrosschainFlags
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCrosschainFlags
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BlockHeaderVerificationFlags == nil {
m.BlockHeaderVerificationFlags = &BlockHeaderVerificationFlags{}
}
if err := m.BlockHeaderVerificationFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCrosschainFlags(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrosschainFlags
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *LegacyCrosschainFlags) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: LegacyCrosschainFlags: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LegacyCrosschainFlags: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsInboundEnabled = bool(v != 0)
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsOutboundEnabled = bool(v != 0)
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCrosschainFlags
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthCrosschainFlags
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.GasPriceIncreaseFlags == nil {
m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{}
}
if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCrosschainFlags(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCrosschainFlags
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipCrosschainFlags(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCrosschainFlags
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthCrosschainFlags
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupCrosschainFlags
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthCrosschainFlags
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthCrosschainFlags = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowCrosschainFlags = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupCrosschainFlags = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/events.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type EventBallotCreated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
BallotIdentifier string `protobuf:"bytes,2,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"`
ObservationHash string `protobuf:"bytes,3,opt,name=observation_hash,json=observationHash,proto3" json:"observation_hash,omitempty"`
ObservationChain string `protobuf:"bytes,4,opt,name=observation_chain,json=observationChain,proto3" json:"observation_chain,omitempty"`
BallotType string `protobuf:"bytes,5,opt,name=ballot_type,json=ballotType,proto3" json:"ballot_type,omitempty"`
}
func (m *EventBallotCreated) Reset() { *m = EventBallotCreated{} }
func (m *EventBallotCreated) String() string { return proto.CompactTextString(m) }
func (*EventBallotCreated) ProtoMessage() {}
func (*EventBallotCreated) Descriptor() ([]byte, []int) {
return fileDescriptor_1f1ca57368474456, []int{0}
}
func (m *EventBallotCreated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventBallotCreated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventBallotCreated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventBallotCreated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventBallotCreated.Merge(m, src)
}
func (m *EventBallotCreated) XXX_Size() int {
return m.Size()
}
func (m *EventBallotCreated) XXX_DiscardUnknown() {
xxx_messageInfo_EventBallotCreated.DiscardUnknown(m)
}
var xxx_messageInfo_EventBallotCreated proto.InternalMessageInfo
func (m *EventBallotCreated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventBallotCreated) GetBallotIdentifier() string {
if m != nil {
return m.BallotIdentifier
}
return ""
}
func (m *EventBallotCreated) GetObservationHash() string {
if m != nil {
return m.ObservationHash
}
return ""
}
func (m *EventBallotCreated) GetObservationChain() string {
if m != nil {
return m.ObservationChain
}
return ""
}
func (m *EventBallotCreated) GetBallotType() string {
if m != nil {
return m.BallotType
}
return ""
}
type EventKeygenBlockUpdated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
KeygenBlock string `protobuf:"bytes,2,opt,name=keygen_block,json=keygenBlock,proto3" json:"keygen_block,omitempty"`
KeygenPubkeys string `protobuf:"bytes,3,opt,name=keygen_pubkeys,json=keygenPubkeys,proto3" json:"keygen_pubkeys,omitempty"`
}
func (m *EventKeygenBlockUpdated) Reset() { *m = EventKeygenBlockUpdated{} }
func (m *EventKeygenBlockUpdated) String() string { return proto.CompactTextString(m) }
func (*EventKeygenBlockUpdated) ProtoMessage() {}
func (*EventKeygenBlockUpdated) Descriptor() ([]byte, []int) {
return fileDescriptor_1f1ca57368474456, []int{1}
}
func (m *EventKeygenBlockUpdated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventKeygenBlockUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventKeygenBlockUpdated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventKeygenBlockUpdated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventKeygenBlockUpdated.Merge(m, src)
}
func (m *EventKeygenBlockUpdated) XXX_Size() int {
return m.Size()
}
func (m *EventKeygenBlockUpdated) XXX_DiscardUnknown() {
xxx_messageInfo_EventKeygenBlockUpdated.DiscardUnknown(m)
}
var xxx_messageInfo_EventKeygenBlockUpdated proto.InternalMessageInfo
func (m *EventKeygenBlockUpdated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventKeygenBlockUpdated) GetKeygenBlock() string {
if m != nil {
return m.KeygenBlock
}
return ""
}
func (m *EventKeygenBlockUpdated) GetKeygenPubkeys() string {
if m != nil {
return m.KeygenPubkeys
}
return ""
}
type EventNewObserverAdded struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
ObserverAddress string `protobuf:"bytes,2,opt,name=observer_address,json=observerAddress,proto3" json:"observer_address,omitempty"`
ZetaclientGranteeAddress string `protobuf:"bytes,3,opt,name=zetaclient_grantee_address,json=zetaclientGranteeAddress,proto3" json:"zetaclient_grantee_address,omitempty"`
ZetaclientGranteePubkey string `protobuf:"bytes,4,opt,name=zetaclient_grantee_pubkey,json=zetaclientGranteePubkey,proto3" json:"zetaclient_grantee_pubkey,omitempty"`
ObserverLastBlockCount uint64 `protobuf:"varint,5,opt,name=observer_last_block_count,json=observerLastBlockCount,proto3" json:"observer_last_block_count,omitempty"`
}
func (m *EventNewObserverAdded) Reset() { *m = EventNewObserverAdded{} }
func (m *EventNewObserverAdded) String() string { return proto.CompactTextString(m) }
func (*EventNewObserverAdded) ProtoMessage() {}
func (*EventNewObserverAdded) Descriptor() ([]byte, []int) {
return fileDescriptor_1f1ca57368474456, []int{2}
}
func (m *EventNewObserverAdded) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventNewObserverAdded) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventNewObserverAdded.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventNewObserverAdded) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventNewObserverAdded.Merge(m, src)
}
func (m *EventNewObserverAdded) XXX_Size() int {
return m.Size()
}
func (m *EventNewObserverAdded) XXX_DiscardUnknown() {
xxx_messageInfo_EventNewObserverAdded.DiscardUnknown(m)
}
var xxx_messageInfo_EventNewObserverAdded proto.InternalMessageInfo
func (m *EventNewObserverAdded) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventNewObserverAdded) GetObserverAddress() string {
if m != nil {
return m.ObserverAddress
}
return ""
}
func (m *EventNewObserverAdded) GetZetaclientGranteeAddress() string {
if m != nil {
return m.ZetaclientGranteeAddress
}
return ""
}
func (m *EventNewObserverAdded) GetZetaclientGranteePubkey() string {
if m != nil {
return m.ZetaclientGranteePubkey
}
return ""
}
func (m *EventNewObserverAdded) GetObserverLastBlockCount() uint64 {
if m != nil {
return m.ObserverLastBlockCount
}
return 0
}
type EventCrosschainFlagsUpdated struct {
MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
IsInboundEnabled bool `protobuf:"varint,2,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
IsOutboundEnabled bool `protobuf:"varint,3,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,4,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"`
Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"`
BlockHeaderVerificationFlags *BlockHeaderVerificationFlags `protobuf:"bytes,6,opt,name=blockHeaderVerificationFlags,proto3" json:"blockHeaderVerificationFlags,omitempty"`
}
func (m *EventCrosschainFlagsUpdated) Reset() { *m = EventCrosschainFlagsUpdated{} }
func (m *EventCrosschainFlagsUpdated) String() string { return proto.CompactTextString(m) }
func (*EventCrosschainFlagsUpdated) ProtoMessage() {}
func (*EventCrosschainFlagsUpdated) Descriptor() ([]byte, []int) {
return fileDescriptor_1f1ca57368474456, []int{3}
}
func (m *EventCrosschainFlagsUpdated) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EventCrosschainFlagsUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EventCrosschainFlagsUpdated.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EventCrosschainFlagsUpdated) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventCrosschainFlagsUpdated.Merge(m, src)
}
func (m *EventCrosschainFlagsUpdated) XXX_Size() int {
return m.Size()
}
func (m *EventCrosschainFlagsUpdated) XXX_DiscardUnknown() {
xxx_messageInfo_EventCrosschainFlagsUpdated.DiscardUnknown(m)
}
var xxx_messageInfo_EventCrosschainFlagsUpdated proto.InternalMessageInfo
func (m *EventCrosschainFlagsUpdated) GetMsgTypeUrl() string {
if m != nil {
return m.MsgTypeUrl
}
return ""
}
func (m *EventCrosschainFlagsUpdated) GetIsInboundEnabled() bool {
if m != nil {
return m.IsInboundEnabled
}
return false
}
func (m *EventCrosschainFlagsUpdated) GetIsOutboundEnabled() bool {
if m != nil {
return m.IsOutboundEnabled
}
return false
}
func (m *EventCrosschainFlagsUpdated) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags {
if m != nil {
return m.GasPriceIncreaseFlags
}
return nil
}
func (m *EventCrosschainFlagsUpdated) GetSigner() string {
if m != nil {
return m.Signer
}
return ""
}
func (m *EventCrosschainFlagsUpdated) GetBlockHeaderVerificationFlags() *BlockHeaderVerificationFlags {
if m != nil {
return m.BlockHeaderVerificationFlags
}
return nil
}
func init() {
proto.RegisterType((*EventBallotCreated)(nil), "zetachain.zetacore.observer.EventBallotCreated")
proto.RegisterType((*EventKeygenBlockUpdated)(nil), "zetachain.zetacore.observer.EventKeygenBlockUpdated")
proto.RegisterType((*EventNewObserverAdded)(nil), "zetachain.zetacore.observer.EventNewObserverAdded")
proto.RegisterType((*EventCrosschainFlagsUpdated)(nil), "zetachain.zetacore.observer.EventCrosschainFlagsUpdated")
}
func init() { proto.RegisterFile("observer/events.proto", fileDescriptor_1f1ca57368474456) }
var fileDescriptor_1f1ca57368474456 = []byte{
// 599 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x6f, 0xd3, 0x30,
0x14, 0x5e, 0xb6, 0x31, 0x81, 0x37, 0xd8, 0x66, 0xb1, 0x2d, 0xeb, 0x50, 0x36, 0x2a, 0x21, 0xf1,
0x33, 0x91, 0xc6, 0x69, 0x88, 0x0b, 0xad, 0xc6, 0x56, 0x81, 0xd8, 0x54, 0x31, 0x0e, 0x5c, 0x22,
0x27, 0x79, 0x4b, 0xac, 0x66, 0x76, 0x65, 0x3b, 0x83, 0x22, 0x71, 0xe4, 0xce, 0x15, 0xfe, 0x22,
0x8e, 0x3b, 0x72, 0xe0, 0x80, 0xd6, 0x7f, 0x04, 0xd9, 0x4e, 0xd3, 0xa2, 0x56, 0x55, 0x6f, 0xce,
0x7b, 0xdf, 0xf7, 0xbd, 0xef, 0xbd, 0xe7, 0x18, 0x6d, 0xf0, 0x48, 0x82, 0xb8, 0x04, 0x11, 0xc0,
0x25, 0x30, 0x25, 0xfd, 0xae, 0xe0, 0x8a, 0xe3, 0x9d, 0x2f, 0xa0, 0x48, 0x9c, 0x11, 0xca, 0x7c,
0x73, 0xe2, 0x02, 0xfc, 0x01, 0xb2, 0x76, 0x37, 0xe5, 0x29, 0x37, 0xb8, 0x40, 0x9f, 0x2c, 0xa5,
0xb6, 0x5b, 0x29, 0xc5, 0x82, 0x4b, 0x69, 0xc8, 0xe1, 0x79, 0x4e, 0xd2, 0x52, 0xb3, 0xb6, 0x55,
0x01, 0x06, 0x07, 0x9b, 0xa8, 0xff, 0x71, 0x10, 0x3e, 0xd4, 0xd5, 0x1b, 0x24, 0xcf, 0xb9, 0x6a,
0x0a, 0x20, 0x0a, 0x12, 0xbc, 0x87, 0x56, 0x2e, 0x64, 0x1a, 0xaa, 0x5e, 0x17, 0xc2, 0x42, 0xe4,
0xae, 0xb3, 0xe7, 0x3c, 0xbc, 0xd5, 0x46, 0x17, 0x32, 0x7d, 0xdf, 0xeb, 0xc2, 0x99, 0xc8, 0xf1,
0x13, 0xb4, 0x1e, 0x19, 0x4a, 0x48, 0x13, 0x60, 0x8a, 0x9e, 0x53, 0x10, 0xee, 0xbc, 0x81, 0xad,
0xd9, 0x44, 0xab, 0x8a, 0xe3, 0x47, 0x68, 0xcd, 0xd6, 0x25, 0x8a, 0x72, 0x16, 0x66, 0x44, 0x66,
0xee, 0x82, 0xc1, 0xae, 0x8e, 0xc4, 0x8f, 0x89, 0xcc, 0xb4, 0xee, 0x28, 0xd4, 0xb4, 0xe2, 0x2e,
0x5a, 0xdd, 0x91, 0x44, 0x53, 0xc7, 0xf1, 0x2e, 0x5a, 0x2e, 0x4d, 0x68, 0xa7, 0xee, 0x0d, 0xeb,
0xd2, 0x86, 0xb4, 0xd1, 0xfa, 0x37, 0x07, 0x6d, 0x99, 0xf6, 0xde, 0x40, 0x2f, 0x05, 0xd6, 0xc8,
0x79, 0xdc, 0x39, 0xeb, 0x26, 0x33, 0xf6, 0x78, 0x1f, 0xad, 0x74, 0x0c, 0x2f, 0x8c, 0x34, 0xb1,
0x6c, 0x6f, 0xb9, 0x33, 0xd4, 0xc2, 0x0f, 0xd0, 0x9d, 0x12, 0xd2, 0x2d, 0xa2, 0x0e, 0xf4, 0x64,
0xd9, 0xd7, 0x6d, 0x1b, 0x3d, 0xb5, 0xc1, 0xfa, 0x8f, 0x79, 0xb4, 0x61, 0x7c, 0xbc, 0x83, 0x4f,
0x27, 0xe5, 0x06, 0x5e, 0x25, 0xc9, 0x4c, 0x2e, 0xaa, 0xe1, 0x81, 0x08, 0x49, 0x92, 0x08, 0x90,
0xb2, 0x74, 0xb2, 0xca, 0x87, 0x52, 0x3a, 0x8c, 0x5f, 0xa2, 0x9a, 0xb9, 0x32, 0x39, 0x05, 0xa6,
0xc2, 0x54, 0x10, 0xa6, 0x00, 0x2a, 0x92, 0x75, 0xe6, 0x0e, 0x11, 0x47, 0x16, 0x30, 0x60, 0xbf,
0x40, 0xdb, 0x13, 0xd8, 0xb6, 0xaf, 0x72, 0x05, 0x5b, 0x63, 0x64, 0xdb, 0x21, 0x3e, 0x40, 0xdb,
0x95, 0xc9, 0x9c, 0x48, 0x65, 0x27, 0x16, 0xc6, 0xbc, 0x60, 0xca, 0xec, 0x65, 0xb1, 0xbd, 0x39,
0x00, 0xbc, 0x25, 0x52, 0x99, 0xe9, 0x35, 0x75, 0xb6, 0xfe, 0x73, 0x01, 0xed, 0x98, 0xd9, 0x34,
0xab, 0xbb, 0xfb, 0x5a, 0x5f, 0xdd, 0xd9, 0xf7, 0xf4, 0x18, 0xad, 0x51, 0xd9, 0x62, 0x11, 0x2f,
0x58, 0x72, 0xc8, 0x48, 0x94, 0x43, 0x62, 0x26, 0x74, 0xb3, 0x3d, 0x16, 0xc7, 0x4f, 0xd1, 0x3a,
0x95, 0x27, 0x85, 0xfa, 0x0f, 0xbc, 0x60, 0xc0, 0xe3, 0x09, 0x9c, 0xa1, 0x8d, 0x94, 0xc8, 0x53,
0x41, 0x63, 0x68, 0xb1, 0x58, 0x00, 0x91, 0x60, 0xbc, 0x99, 0x71, 0x2c, 0xef, 0xef, 0xfb, 0x53,
0xfe, 0x55, 0xff, 0x68, 0x12, 0xb3, 0x3d, 0x59, 0x10, 0x6f, 0xa2, 0x25, 0x49, 0x53, 0x06, 0xa2,
0xbc, 0xc5, 0xe5, 0x17, 0xfe, 0x8a, 0xee, 0x99, 0x51, 0x1e, 0x03, 0x49, 0x40, 0x7c, 0x00, 0x41,
0xcf, 0x69, 0x6c, 0x7e, 0x01, 0x6b, 0x64, 0xc9, 0x18, 0x39, 0x98, 0x6a, 0xa4, 0x31, 0x45, 0xa0,
0x3d, 0x55, 0xbe, 0xd1, 0xfa, 0x75, 0xed, 0x39, 0x57, 0xd7, 0x9e, 0xf3, 0xf7, 0xda, 0x73, 0xbe,
0xf7, 0xbd, 0xb9, 0xab, 0xbe, 0x37, 0xf7, 0xbb, 0xef, 0xcd, 0x7d, 0x0c, 0x52, 0xaa, 0xb2, 0x22,
0xf2, 0x63, 0x7e, 0x11, 0xe8, 0x92, 0xcf, 0x4c, 0xf5, 0x60, 0x50, 0x3d, 0xf8, 0x5c, 0x3d, 0x35,
0x81, 0x5e, 0x9d, 0x8c, 0x96, 0xcc, 0x8b, 0xf3, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xea,
0x9e, 0x8b, 0x9e, 0xf7, 0x04, 0x00, 0x00,
}
func (m *EventBallotCreated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventBallotCreated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventBallotCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BallotType) > 0 {
i -= len(m.BallotType)
copy(dAtA[i:], m.BallotType)
i = encodeVarintEvents(dAtA, i, uint64(len(m.BallotType)))
i--
dAtA[i] = 0x2a
}
if len(m.ObservationChain) > 0 {
i -= len(m.ObservationChain)
copy(dAtA[i:], m.ObservationChain)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ObservationChain)))
i--
dAtA[i] = 0x22
}
if len(m.ObservationHash) > 0 {
i -= len(m.ObservationHash)
copy(dAtA[i:], m.ObservationHash)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ObservationHash)))
i--
dAtA[i] = 0x1a
}
if len(m.BallotIdentifier) > 0 {
i -= len(m.BallotIdentifier)
copy(dAtA[i:], m.BallotIdentifier)
i = encodeVarintEvents(dAtA, i, uint64(len(m.BallotIdentifier)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventKeygenBlockUpdated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventKeygenBlockUpdated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventKeygenBlockUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.KeygenPubkeys) > 0 {
i -= len(m.KeygenPubkeys)
copy(dAtA[i:], m.KeygenPubkeys)
i = encodeVarintEvents(dAtA, i, uint64(len(m.KeygenPubkeys)))
i--
dAtA[i] = 0x1a
}
if len(m.KeygenBlock) > 0 {
i -= len(m.KeygenBlock)
copy(dAtA[i:], m.KeygenBlock)
i = encodeVarintEvents(dAtA, i, uint64(len(m.KeygenBlock)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventNewObserverAdded) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventNewObserverAdded) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventNewObserverAdded) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ObserverLastBlockCount != 0 {
i = encodeVarintEvents(dAtA, i, uint64(m.ObserverLastBlockCount))
i--
dAtA[i] = 0x28
}
if len(m.ZetaclientGranteePubkey) > 0 {
i -= len(m.ZetaclientGranteePubkey)
copy(dAtA[i:], m.ZetaclientGranteePubkey)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ZetaclientGranteePubkey)))
i--
dAtA[i] = 0x22
}
if len(m.ZetaclientGranteeAddress) > 0 {
i -= len(m.ZetaclientGranteeAddress)
copy(dAtA[i:], m.ZetaclientGranteeAddress)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ZetaclientGranteeAddress)))
i--
dAtA[i] = 0x1a
}
if len(m.ObserverAddress) > 0 {
i -= len(m.ObserverAddress)
copy(dAtA[i:], m.ObserverAddress)
i = encodeVarintEvents(dAtA, i, uint64(len(m.ObserverAddress)))
i--
dAtA[i] = 0x12
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *EventCrosschainFlagsUpdated) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EventCrosschainFlagsUpdated) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EventCrosschainFlagsUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockHeaderVerificationFlags != nil {
{
size, err := m.BlockHeaderVerificationFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
if len(m.Signer) > 0 {
i -= len(m.Signer)
copy(dAtA[i:], m.Signer)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer)))
i--
dAtA[i] = 0x2a
}
if m.GasPriceIncreaseFlags != nil {
{
size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
if m.IsOutboundEnabled {
i--
if m.IsOutboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
}
if m.IsInboundEnabled {
i--
if m.IsInboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
if len(m.MsgTypeUrl) > 0 {
i -= len(m.MsgTypeUrl)
copy(dAtA[i:], m.MsgTypeUrl)
i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
offset -= sovEvents(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *EventBallotCreated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.BallotIdentifier)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ObservationHash)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ObservationChain)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.BallotType)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventKeygenBlockUpdated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.KeygenBlock)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.KeygenPubkeys)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func (m *EventNewObserverAdded) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ObserverAddress)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ZetaclientGranteeAddress)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.ZetaclientGranteePubkey)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.ObserverLastBlockCount != 0 {
n += 1 + sovEvents(uint64(m.ObserverLastBlockCount))
}
return n
}
func (m *EventCrosschainFlagsUpdated) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MsgTypeUrl)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.IsInboundEnabled {
n += 2
}
if m.IsOutboundEnabled {
n += 2
}
if m.GasPriceIncreaseFlags != nil {
l = m.GasPriceIncreaseFlags.Size()
n += 1 + l + sovEvents(uint64(l))
}
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.BlockHeaderVerificationFlags != nil {
l = m.BlockHeaderVerificationFlags.Size()
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func sovEvents(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozEvents(x uint64) (n int) {
return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *EventBallotCreated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventBallotCreated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventBallotCreated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservationHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObservationHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservationChain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObservationChain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotType", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BallotType = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventKeygenBlockUpdated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventKeygenBlockUpdated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventKeygenBlockUpdated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field KeygenBlock", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.KeygenBlock = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field KeygenPubkeys", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.KeygenPubkeys = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventNewObserverAdded) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventNewObserverAdded: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventNewObserverAdded: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ZetaclientGranteeAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ZetaclientGranteeAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ZetaclientGranteePubkey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ZetaclientGranteePubkey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverLastBlockCount", wireType)
}
m.ObserverLastBlockCount = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ObserverLastBlockCount |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *EventCrosschainFlagsUpdated) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EventCrosschainFlagsUpdated: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EventCrosschainFlagsUpdated: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MsgTypeUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsInboundEnabled = bool(v != 0)
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsOutboundEnabled = bool(v != 0)
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.GasPriceIncreaseFlags == nil {
m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{}
}
if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeaderVerificationFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthEvents
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BlockHeaderVerificationFlags == nil {
m.BlockHeaderVerificationFlags = &BlockHeaderVerificationFlags{}
}
if err := m.BlockHeaderVerificationFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEvents(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthEvents
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEvents
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
"encoding/json"
"fmt"
"github.com/cosmos/cosmos-sdk/codec"
)
// DefaultGenesis returns the default observer genesis state
func DefaultGenesis() *GenesisState {
params := DefaultParams()
return &GenesisState{
Params: ¶ms,
Ballots: nil,
Observers: nil,
NodeAccountList: []*NodeAccount{},
CrosschainFlags: &CrosschainFlags{IsInboundEnabled: true, IsOutboundEnabled: true},
Keygen: nil,
LastObserverCount: nil,
}
}
// Validate performs basic genesis state validation returning an error upon any failure.
func (gs GenesisState) Validate() error {
if gs.Params != nil {
err := gs.Params.Validate()
if err != nil {
return err
}
}
// Check for duplicated index in nodeAccount
nodeAccountIndexMap := make(map[string]bool)
for _, elem := range gs.NodeAccountList {
if _, ok := nodeAccountIndexMap[elem.GetOperator()]; ok {
return fmt.Errorf("duplicated index for nodeAccount")
}
nodeAccountIndexMap[elem.GetOperator()] = true
}
return VerifyObserverMapper(gs.Observers)
}
func GetGenesisStateFromAppState(marshaler codec.JSONCodec, appState map[string]json.RawMessage) GenesisState {
var genesisState GenesisState
if appState[ModuleName] != nil {
err := marshaler.UnmarshalJSON(appState[ModuleName], &genesisState)
if err != nil {
panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error()))
}
}
return genesisState
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/genesis.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type GenesisState struct {
Ballots []*Ballot `protobuf:"bytes,1,rep,name=ballots,proto3" json:"ballots,omitempty"`
Observers []*ObserverMapper `protobuf:"bytes,2,rep,name=observers,proto3" json:"observers,omitempty"`
NodeAccountList []*NodeAccount `protobuf:"bytes,3,rep,name=nodeAccountList,proto3" json:"nodeAccountList,omitempty"`
CrosschainFlags *CrosschainFlags `protobuf:"bytes,4,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags,omitempty"`
Params *Params `protobuf:"bytes,5,opt,name=params,proto3" json:"params,omitempty"`
Keygen *Keygen `protobuf:"bytes,6,opt,name=keygen,proto3" json:"keygen,omitempty"`
LastObserverCount *LastObserverCount `protobuf:"bytes,7,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"`
CoreParamsList CoreParamsList `protobuf:"bytes,8,opt,name=core_params_list,json=coreParamsList,proto3" json:"core_params_list"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_15ea8c9d44da7399, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetBallots() []*Ballot {
if m != nil {
return m.Ballots
}
return nil
}
func (m *GenesisState) GetObservers() []*ObserverMapper {
if m != nil {
return m.Observers
}
return nil
}
func (m *GenesisState) GetNodeAccountList() []*NodeAccount {
if m != nil {
return m.NodeAccountList
}
return nil
}
func (m *GenesisState) GetCrosschainFlags() *CrosschainFlags {
if m != nil {
return m.CrosschainFlags
}
return nil
}
func (m *GenesisState) GetParams() *Params {
if m != nil {
return m.Params
}
return nil
}
func (m *GenesisState) GetKeygen() *Keygen {
if m != nil {
return m.Keygen
}
return nil
}
func (m *GenesisState) GetLastObserverCount() *LastObserverCount {
if m != nil {
return m.LastObserverCount
}
return nil
}
func (m *GenesisState) GetCoreParamsList() CoreParamsList {
if m != nil {
return m.CoreParamsList
}
return CoreParamsList{}
}
func init() {
proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.observer.GenesisState")
}
func init() { proto.RegisterFile("observer/genesis.proto", fileDescriptor_15ea8c9d44da7399) }
var fileDescriptor_15ea8c9d44da7399 = []byte{
// 431 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x5f, 0xab, 0xd3, 0x30,
0x18, 0xc6, 0x5b, 0x37, 0x37, 0xcd, 0xc4, 0xcd, 0xf8, 0xaf, 0x6c, 0xd0, 0x0d, 0xbd, 0x19, 0xa8,
0x2d, 0xcc, 0x4b, 0xf1, 0xc2, 0x0d, 0x94, 0xe1, 0xfc, 0x43, 0xbc, 0x10, 0x14, 0x2c, 0x69, 0x8d,
0x5d, 0xb1, 0x6b, 0x4a, 0x92, 0x89, 0xf3, 0x53, 0xf8, 0xb1, 0x76, 0xb9, 0xcb, 0x73, 0x75, 0x38,
0x6c, 0x5f, 0xe3, 0x5c, 0x1c, 0x92, 0x34, 0x1d, 0xdb, 0xa0, 0x9c, 0xbb, 0x97, 0x27, 0xef, 0xf3,
0x4b, 0xde, 0xe7, 0x0d, 0x78, 0x44, 0x43, 0x4e, 0xd8, 0x1f, 0xc2, 0xfc, 0x98, 0x64, 0x84, 0x27,
0xdc, 0xcb, 0x19, 0x15, 0x14, 0xf6, 0xfe, 0x11, 0x81, 0xa3, 0x39, 0x4e, 0x32, 0x4f, 0x55, 0x94,
0x11, 0xcf, 0xb4, 0x76, 0x1f, 0xc4, 0x34, 0xa6, 0xaa, 0xcf, 0x97, 0x95, 0xb6, 0x74, 0x1f, 0x96,
0xa8, 0x10, 0xa7, 0x29, 0x15, 0x85, 0xdc, 0x2f, 0xe5, 0x88, 0x51, 0xce, 0x15, 0x33, 0xf8, 0x95,
0xe2, 0x98, 0x9f, 0xf8, 0x7e, 0x93, 0x55, 0x4c, 0xb2, 0x42, 0xee, 0x95, 0x72, 0x46, 0x7f, 0x92,
0x00, 0x47, 0x11, 0x5d, 0x66, 0x06, 0xfa, 0xb8, 0x3c, 0x34, 0xc5, 0x09, 0x2c, 0xc7, 0x0c, 0x2f,
0x8a, 0x3b, 0x9e, 0x5c, 0xd6, 0xc1, 0x9d, 0x77, 0x7a, 0xc0, 0x2f, 0x02, 0x0b, 0x02, 0x5f, 0x83,
0xa6, 0x7e, 0x25, 0x77, 0xec, 0x41, 0x6d, 0xd8, 0x1a, 0x3d, 0xf5, 0x2a, 0x26, 0xf6, 0xc6, 0xaa,
0x17, 0x19, 0x0f, 0x9c, 0x82, 0xdb, 0xe6, 0x8c, 0x3b, 0x37, 0x14, 0xe0, 0x59, 0x25, 0xe0, 0x53,
0x51, 0x7c, 0xc0, 0x79, 0x4e, 0x18, 0xda, 0xbb, 0x21, 0x02, 0x6d, 0x39, 0xe0, 0x1b, 0x3d, 0xdf,
0x2c, 0xe1, 0xc2, 0xa9, 0x29, 0xe0, 0xb0, 0x12, 0xf8, 0x71, 0xef, 0x41, 0xc7, 0x00, 0xf8, 0x15,
0x74, 0x8e, 0xc3, 0x76, 0xea, 0x03, 0x7b, 0xd8, 0x1a, 0x3d, 0xaf, 0x84, 0x4e, 0x4a, 0xd3, 0x5b,
0xe9, 0x41, 0xed, 0xe8, 0x50, 0x80, 0xaf, 0x40, 0x43, 0xe7, 0xea, 0xdc, 0x54, 0xb8, 0xea, 0xd4,
0x3e, 0xab, 0x56, 0x54, 0x58, 0xa4, 0x59, 0x6f, 0xd8, 0x69, 0x5c, 0xc3, 0xfc, 0x5e, 0xb5, 0xa2,
0xc2, 0x02, 0x7f, 0x80, 0xfb, 0x29, 0xe6, 0x22, 0x30, 0xe7, 0x81, 0x9a, 0xd6, 0x69, 0x2a, 0x92,
0x57, 0x49, 0x9a, 0x61, 0x2e, 0x4c, 0xfe, 0x13, 0x15, 0xd8, 0xbd, 0xf4, 0x58, 0x82, 0xdf, 0x41,
0x47, 0xba, 0x02, 0xfd, 0xd6, 0x20, 0x95, 0x7b, 0xb8, 0xa5, 0xe0, 0xd5, 0x8b, 0x9d, 0x50, 0x46,
0xf4, 0x9c, 0x32, 0xf9, 0x71, 0x7d, 0x7d, 0xde, 0xb7, 0xd0, 0xdd, 0xe8, 0x50, 0x9d, 0xae, 0xb7,
0xae, 0xbd, 0xd9, 0xba, 0xf6, 0xc5, 0xd6, 0xb5, 0xff, 0xef, 0x5c, 0x6b, 0xb3, 0x73, 0xad, 0xb3,
0x9d, 0x6b, 0x7d, 0xf3, 0xe3, 0x44, 0xcc, 0x97, 0xa1, 0x17, 0xd1, 0x85, 0x2f, 0xe1, 0x2f, 0xd4,
0x3d, 0xbe, 0xb9, 0xc7, 0xff, 0x5b, 0x7e, 0x70, 0x5f, 0xac, 0x72, 0xc2, 0xc3, 0x86, 0xfa, 0xd0,
0x2f, 0xaf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xb6, 0x15, 0x7a, 0xb9, 0x03, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.CoreParamsList.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
if m.LastObserverCount != nil {
{
size, err := m.LastObserverCount.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
}
if m.Keygen != nil {
{
size, err := m.Keygen.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
if m.Params != nil {
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
if m.CrosschainFlags != nil {
{
size, err := m.CrosschainFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
if len(m.NodeAccountList) > 0 {
for iNdEx := len(m.NodeAccountList) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.NodeAccountList[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
}
if len(m.Observers) > 0 {
for iNdEx := len(m.Observers) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Observers[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Ballots) > 0 {
for iNdEx := len(m.Ballots) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Ballots[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Ballots) > 0 {
for _, e := range m.Ballots {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.Observers) > 0 {
for _, e := range m.Observers {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.NodeAccountList) > 0 {
for _, e := range m.NodeAccountList {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if m.CrosschainFlags != nil {
l = m.CrosschainFlags.Size()
n += 1 + l + sovGenesis(uint64(l))
}
if m.Params != nil {
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
}
if m.Keygen != nil {
l = m.Keygen.Size()
n += 1 + l + sovGenesis(uint64(l))
}
if m.LastObserverCount != nil {
l = m.LastObserverCount.Size()
n += 1 + l + sovGenesis(uint64(l))
}
l = m.CoreParamsList.Size()
n += 1 + l + sovGenesis(uint64(l))
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Ballots", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Ballots = append(m.Ballots, &Ballot{})
if err := m.Ballots[len(m.Ballots)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Observers", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Observers = append(m.Observers, &ObserverMapper{})
if err := m.Observers[len(m.Observers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NodeAccountList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NodeAccountList = append(m.NodeAccountList, &NodeAccount{})
if err := m.NodeAccountList[len(m.NodeAccountList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CrosschainFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.CrosschainFlags == nil {
m.CrosschainFlags = &CrosschainFlags{}
}
if err := m.CrosschainFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Params == nil {
m.Params = &Params{}
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Keygen", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Keygen == nil {
m.Keygen = &Keygen{}
}
if err := m.Keygen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LastObserverCount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.LastObserverCount == nil {
m.LastObserverCount = &LastObserverCount{}
}
if err := m.LastObserverCount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CoreParamsList", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.CoreParamsList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/keygen.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type KeygenStatus int32
const (
KeygenStatus_PendingKeygen KeygenStatus = 0
KeygenStatus_KeyGenSuccess KeygenStatus = 1
KeygenStatus_KeyGenFailed KeygenStatus = 3
)
var KeygenStatus_name = map[int32]string{
0: "PendingKeygen",
1: "KeyGenSuccess",
3: "KeyGenFailed",
}
var KeygenStatus_value = map[string]int32{
"PendingKeygen": 0,
"KeyGenSuccess": 1,
"KeyGenFailed": 3,
}
func (x KeygenStatus) String() string {
return proto.EnumName(KeygenStatus_name, int32(x))
}
func (KeygenStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_4efb2de738775c96, []int{0}
}
type Keygen struct {
Status KeygenStatus `protobuf:"varint,2,opt,name=status,proto3,enum=zetachain.zetacore.observer.KeygenStatus" json:"status,omitempty"`
GranteePubkeys []string `protobuf:"bytes,3,rep,name=granteePubkeys,proto3" json:"granteePubkeys,omitempty"`
BlockNumber int64 `protobuf:"varint,4,opt,name=blockNumber,proto3" json:"blockNumber,omitempty"`
}
func (m *Keygen) Reset() { *m = Keygen{} }
func (m *Keygen) String() string { return proto.CompactTextString(m) }
func (*Keygen) ProtoMessage() {}
func (*Keygen) Descriptor() ([]byte, []int) {
return fileDescriptor_4efb2de738775c96, []int{0}
}
func (m *Keygen) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Keygen) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Keygen.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Keygen) XXX_Merge(src proto.Message) {
xxx_messageInfo_Keygen.Merge(m, src)
}
func (m *Keygen) XXX_Size() int {
return m.Size()
}
func (m *Keygen) XXX_DiscardUnknown() {
xxx_messageInfo_Keygen.DiscardUnknown(m)
}
var xxx_messageInfo_Keygen proto.InternalMessageInfo
func (m *Keygen) GetStatus() KeygenStatus {
if m != nil {
return m.Status
}
return KeygenStatus_PendingKeygen
}
func (m *Keygen) GetGranteePubkeys() []string {
if m != nil {
return m.GranteePubkeys
}
return nil
}
func (m *Keygen) GetBlockNumber() int64 {
if m != nil {
return m.BlockNumber
}
return 0
}
func init() {
proto.RegisterEnum("zetachain.zetacore.observer.KeygenStatus", KeygenStatus_name, KeygenStatus_value)
proto.RegisterType((*Keygen)(nil), "zetachain.zetacore.observer.Keygen")
}
func init() { proto.RegisterFile("observer/keygen.proto", fileDescriptor_4efb2de738775c96) }
var fileDescriptor_4efb2de738775c96 = []byte{
// 293 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0x4f, 0x2a, 0x4e,
0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0xcf, 0x4e, 0xad, 0x4c, 0x4f, 0xcd, 0xd3, 0x2b, 0x28, 0xca, 0x2f,
0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2,
0x8b, 0x52, 0xf5, 0x60, 0x2a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, 0x2c,
0x88, 0x16, 0xa5, 0xa9, 0x8c, 0x5c, 0x6c, 0xde, 0x60, 0x33, 0x84, 0x1c, 0xb9, 0xd8, 0x8a, 0x4b,
0x12, 0x4b, 0x4a, 0x8b, 0x25, 0x98, 0x14, 0x18, 0x35, 0xf8, 0x8c, 0x34, 0xf5, 0xf0, 0x18, 0xa7,
0x07, 0xd1, 0x14, 0x0c, 0xd6, 0x10, 0x04, 0xd5, 0x28, 0xa4, 0xc6, 0xc5, 0x97, 0x5e, 0x94, 0x98,
0x57, 0x92, 0x9a, 0x1a, 0x50, 0x9a, 0x94, 0x9d, 0x5a, 0x59, 0x2c, 0xc1, 0xac, 0xc0, 0xac, 0xc1,
0x19, 0x84, 0x26, 0x2a, 0xa4, 0xc0, 0xc5, 0x9d, 0x94, 0x93, 0x9f, 0x9c, 0xed, 0x57, 0x9a, 0x9b,
0x94, 0x5a, 0x24, 0xc1, 0xa2, 0xc0, 0xa8, 0xc1, 0x1c, 0x84, 0x2c, 0xa4, 0xe5, 0xc3, 0xc5, 0x83,
0x6c, 0x83, 0x90, 0x20, 0x17, 0x6f, 0x40, 0x6a, 0x5e, 0x4a, 0x66, 0x5e, 0x3a, 0x44, 0x58, 0x80,
0x01, 0x24, 0xe4, 0x9d, 0x5a, 0xe9, 0x9e, 0x9a, 0x17, 0x5c, 0x9a, 0x9c, 0x9c, 0x5a, 0x5c, 0x2c,
0xc0, 0x28, 0x24, 0x00, 0xd6, 0xe5, 0x9e, 0x9a, 0xe7, 0x96, 0x98, 0x99, 0x93, 0x9a, 0x22, 0xc0,
0x2c, 0xc5, 0xb2, 0x62, 0x89, 0x1c, 0xa3, 0x93, 0xe7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9,
0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e,
0xcb, 0x31, 0x44, 0xe9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83,
0x3c, 0xa9, 0x0b, 0xf6, 0xaf, 0x3e, 0xcc, 0xbf, 0xfa, 0x15, 0xfa, 0xf0, 0xa0, 0x2e, 0xa9, 0x2c,
0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0x9b, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xd3, 0xf7, 0xb2,
0x79, 0x83, 0x01, 0x00, 0x00,
}
func (m *Keygen) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Keygen) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Keygen) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockNumber != 0 {
i = encodeVarintKeygen(dAtA, i, uint64(m.BlockNumber))
i--
dAtA[i] = 0x20
}
if len(m.GranteePubkeys) > 0 {
for iNdEx := len(m.GranteePubkeys) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.GranteePubkeys[iNdEx])
copy(dAtA[i:], m.GranteePubkeys[iNdEx])
i = encodeVarintKeygen(dAtA, i, uint64(len(m.GranteePubkeys[iNdEx])))
i--
dAtA[i] = 0x1a
}
}
if m.Status != 0 {
i = encodeVarintKeygen(dAtA, i, uint64(m.Status))
i--
dAtA[i] = 0x10
}
return len(dAtA) - i, nil
}
func encodeVarintKeygen(dAtA []byte, offset int, v uint64) int {
offset -= sovKeygen(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Keygen) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Status != 0 {
n += 1 + sovKeygen(uint64(m.Status))
}
if len(m.GranteePubkeys) > 0 {
for _, s := range m.GranteePubkeys {
l = len(s)
n += 1 + l + sovKeygen(uint64(l))
}
}
if m.BlockNumber != 0 {
n += 1 + sovKeygen(uint64(m.BlockNumber))
}
return n
}
func sovKeygen(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozKeygen(x uint64) (n int) {
return sovKeygen(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Keygen) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowKeygen
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Keygen: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Keygen: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
m.Status = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowKeygen
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Status |= KeygenStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GranteePubkeys", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowKeygen
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthKeygen
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthKeygen
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GranteePubkeys = append(m.GranteePubkeys, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType)
}
m.BlockNumber = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowKeygen
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BlockNumber |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipKeygen(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthKeygen
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipKeygen(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowKeygen
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowKeygen
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowKeygen
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthKeygen
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupKeygen
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthKeygen
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthKeygen = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowKeygen = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupKeygen = fmt.Errorf("proto: unexpected end of group")
)
package types
import "fmt"
const (
// ModuleName defines the module name
ModuleName = "observer"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey is the message route for slashing
RouterKey = ModuleName
// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_observer"
GroupID1Address = "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73"
)
func KeyPrefix(p string) []byte {
return []byte(p)
}
func BallotListKeyPrefix(p int64) []byte {
return []byte(fmt.Sprintf("%d", p))
}
const (
BlameKey = "Blame-"
// TODO change identifier for VoterKey to something more descriptive
VoterKey = "Voter-value-"
AllCoreParams = "CoreParams"
ObserverMapperKey = "Observer-value-"
ObserverParamsKey = "ObserverParams"
AdminPolicyParamsKey = "AdminParams"
BallotMaturityBlocksParamsKey = "BallotMaturityBlocksParams"
// CrosschainFlagsKey is the key for the crosschain flags
// NOTE: PermissionFlags is old name for CrosschainFlags we keep it as key value for backward compatibility
CrosschainFlagsKey = "PermissionFlags-value-"
LastBlockObserverCountKey = "ObserverCount-value-"
NodeAccountKey = "NodeAccount-value-"
KeygenKey = "Keygen-value-"
BlockHeaderKey = "BlockHeader-value-"
BallotListKey = "BallotList-value-"
)
func GetBlameIndex(chainID int64, nonce uint64, digest string, height uint64) string {
return fmt.Sprintf("%d-%d-%s-%d", chainID, nonce, digest, height)
}
func GetBlamePrefix(chainID int64, nonce int64) string {
return fmt.Sprintf("%d-%d", chainID, nonce)
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/crypto"
"github.com/zeta-chain/zetacore/common"
)
const TypeMsgAddBlameVote = "add_blame_vote"
var _ sdk.Msg = &MsgAddBlameVote{}
func NewMsgAddBlameVoteMsg(creator string, chainID int64, blameInfo *Blame) *MsgAddBlameVote {
return &MsgAddBlameVote{
Creator: creator,
ChainId: chainID,
BlameInfo: blameInfo,
}
}
func (m *MsgAddBlameVote) Route() string {
return RouterKey
}
func (m *MsgAddBlameVote) Type() string {
return TypeMsgAddBlameVote
}
func (m *MsgAddBlameVote) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(m.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if common.GetChainFromChainID(m.ChainId) == nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidChainID, "chain id (%d)", m.ChainId)
}
return nil
}
func (m *MsgAddBlameVote) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(m.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (m *MsgAddBlameVote) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(m)
return sdk.MustSortJSON(bz)
}
func (m *MsgAddBlameVote) Digest() string {
msg := *m
msg.Creator = ""
// Generate an Identifier for the ballot corresponding to specific blame data
hash := crypto.Keccak256Hash([]byte(msg.String()))
return hash.Hex()
}
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
)
const TypeMsgAddObserver = "add_observer"
var _ sdk.Msg = &MsgAddObserver{}
func NewMsgAddObserver(creator string, observerAdresss string, zetaclientGranteePubKey string, addNodeAccountOnly bool) *MsgAddObserver {
return &MsgAddObserver{
Creator: creator,
ObserverAddress: observerAdresss,
ZetaclientGranteePubkey: zetaclientGranteePubKey,
AddNodeAccountOnly: addNodeAccountOnly,
}
}
func (msg *MsgAddObserver) Route() string {
return RouterKey
}
func (msg *MsgAddObserver) Type() string {
return TypeMsgAddObserver
}
func (msg *MsgAddObserver) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgAddObserver) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgAddObserver) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
_, err = sdk.AccAddressFromBech32(msg.ObserverAddress)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid observer address (%s)", err)
}
_, err = common.NewPubKey(msg.ZetaclientGranteePubkey)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid zetaclient grantee pubkey (%s)", err)
}
_, err = common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid zetaclient grantee pubkey (%s)", err)
}
return nil
}
package types
import (
"fmt"
"strings"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/zeta-chain/zetacore/common"
)
const TypeMsgUpdateClientParams = "update_client_params"
var _ sdk.Msg = &MsgUpdateCoreParams{}
func NewMsgUpdateCoreParams(creator string, coreParams *CoreParams) *MsgUpdateCoreParams {
return &MsgUpdateCoreParams{
Creator: creator,
CoreParams: coreParams,
}
}
func (msg *MsgUpdateCoreParams) Route() string {
return RouterKey
}
func (msg *MsgUpdateCoreParams) Type() string {
return TypeMsgUpdateClientParams
}
func (msg *MsgUpdateCoreParams) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateCoreParams) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateCoreParams) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return ValidateCoreParams(msg.CoreParams)
}
// ValidateCoreParams performs some basic checks on core params
func ValidateCoreParams(params *CoreParams) error {
if params == nil {
return fmt.Errorf("core params cannot be nil")
}
chain := common.GetChainFromChainID(params.ChainId)
if chain == nil {
return fmt.Errorf("ChainId %d not supported", params.ChainId)
}
// zeta chain skips the rest of the checks for now
if chain.IsZetaChain() {
return nil
}
if params.ConfirmationCount == 0 {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "ConfirmationCount must be greater than 0")
}
if params.GasPriceTicker <= 0 || params.GasPriceTicker > 300 {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "GasPriceTicker %d out of range", params.GasPriceTicker)
}
if params.InTxTicker <= 0 || params.InTxTicker > 300 {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "InTxTicker %d out of range", params.InTxTicker)
}
if params.OutTxTicker <= 0 || params.OutTxTicker > 300 {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "OutTxTicker %d out of range", params.OutTxTicker)
}
if params.OutboundTxScheduleInterval == 0 || params.OutboundTxScheduleInterval > 100 { // 600 secs
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "OutboundTxScheduleInterval %d out of range", params.OutboundTxScheduleInterval)
}
if params.OutboundTxScheduleLookahead == 0 || params.OutboundTxScheduleLookahead > 500 { // 500 cctxs
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "OutboundTxScheduleLookahead %d out of range", params.OutboundTxScheduleLookahead)
}
// chain type specific checks
if common.IsBitcoinChain(params.ChainId) {
if params.WatchUtxoTicker == 0 || params.WatchUtxoTicker > 300 {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "WatchUtxoTicker %d out of range", params.WatchUtxoTicker)
}
}
if common.IsEVMChain(params.ChainId) {
if !validCoreContractAddress(params.ZetaTokenContractAddress) {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid ZetaTokenContractAddress %s", params.ZetaTokenContractAddress)
}
if !validCoreContractAddress(params.ConnectorContractAddress) {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid ConnectorContractAddress %s", params.ConnectorContractAddress)
}
if !validCoreContractAddress(params.Erc20CustodyContractAddress) {
return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid Erc20CustodyContractAddress %s", params.Erc20CustodyContractAddress)
}
}
return nil
}
func validCoreContractAddress(address string) bool {
if !strings.HasPrefix(address, "0x") {
return false
}
return ethcommon.IsHexAddress(address)
}
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgUpdateKeygen = "update_keygen"
var _ sdk.Msg = &MsgUpdateKeygen{}
func NewMsgUpdateKeygen(creator string, block int64) *MsgUpdateKeygen {
return &MsgUpdateKeygen{
Creator: creator,
Block: block,
}
}
func (msg *MsgUpdateKeygen) Route() string {
return RouterKey
}
func (msg *MsgUpdateKeygen) Type() string {
return TypeMsgUpdateKeygen
}
func (msg *MsgUpdateKeygen) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateKeygen) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateKeygen) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}
package types
import (
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/crypto"
"github.com/zeta-chain/zetacore/common"
)
var _ sdk.Msg = &MsgAddBlockHeader{}
const (
TypeMsgAddBlockHeader = "add_block_header"
)
func NewMsgAddBlockHeader(creator string, chainID int64, blockHash []byte, height int64, header common.HeaderData) *MsgAddBlockHeader {
return &MsgAddBlockHeader{
Creator: creator,
ChainId: chainID,
BlockHash: blockHash,
Height: height,
Header: header,
}
}
func (msg *MsgAddBlockHeader) Route() string {
return RouterKey
}
func (msg *MsgAddBlockHeader) Type() string {
return TypeMsgAddBlockHeader
}
func (msg *MsgAddBlockHeader) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgAddBlockHeader) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgAddBlockHeader) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}
if common.IsHeaderSupportedEvmChain(msg.ChainId) || common.IsBitcoinChain(msg.ChainId) {
if len(msg.BlockHash) != 32 {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block hash length (%d)", len(msg.BlockHash))
}
} else {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain id (%d)", msg.ChainId)
}
if err := msg.Header.Validate(msg.BlockHash, msg.ChainId, msg.Height); err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header (%s)", err)
}
if _, err := msg.Header.ParentHash(); err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "can't get parent hash (%s)", err)
}
return nil
}
func (msg *MsgAddBlockHeader) Digest() string {
m := *msg
m.Creator = ""
hash := crypto.Keccak256Hash([]byte(m.String()))
return hash.Hex()
}
package types
import (
"errors"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const (
TypeMsgUpdateCrosschainFlags = "update_crosschain_flags"
)
var _ sdk.Msg = &MsgUpdateCrosschainFlags{}
func NewMsgUpdateCrosschainFlags(creator string, isInboundEnabled, isOutboundEnabled bool) *MsgUpdateCrosschainFlags {
return &MsgUpdateCrosschainFlags{
Creator: creator,
IsInboundEnabled: isInboundEnabled,
IsOutboundEnabled: isOutboundEnabled,
}
}
func (msg *MsgUpdateCrosschainFlags) Route() string {
return RouterKey
}
func (msg *MsgUpdateCrosschainFlags) Type() string {
return TypeMsgUpdateCrosschainFlags
}
func (msg *MsgUpdateCrosschainFlags) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUpdateCrosschainFlags) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateCrosschainFlags) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
if msg.GasPriceIncreaseFlags != nil {
if err := msg.GasPriceIncreaseFlags.Validate(); err != nil {
return cosmoserrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}
}
return nil
}
func (gpf GasPriceIncreaseFlags) Validate() error {
if gpf.EpochLength <= 0 {
return errors.New("epoch length must be positive")
}
if gpf.RetryInterval <= 0 {
return errors.New("retry interval must be positive")
}
return nil
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/node_account.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type NodeStatus int32
const (
NodeStatus_Unknown NodeStatus = 0
NodeStatus_Whitelisted NodeStatus = 1
NodeStatus_Standby NodeStatus = 2
NodeStatus_Ready NodeStatus = 3
NodeStatus_Active NodeStatus = 4
NodeStatus_Disabled NodeStatus = 5
)
var NodeStatus_name = map[int32]string{
0: "Unknown",
1: "Whitelisted",
2: "Standby",
3: "Ready",
4: "Active",
5: "Disabled",
}
var NodeStatus_value = map[string]int32{
"Unknown": 0,
"Whitelisted": 1,
"Standby": 2,
"Ready": 3,
"Active": 4,
"Disabled": 5,
}
func (x NodeStatus) String() string {
return proto.EnumName(NodeStatus_name, int32(x))
}
func (NodeStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_6f54e38f9d1a9953, []int{0}
}
type NodeAccount struct {
Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"`
GranteeAddress string `protobuf:"bytes,2,opt,name=granteeAddress,proto3" json:"granteeAddress,omitempty"`
GranteePubkey *common.PubKeySet `protobuf:"bytes,3,opt,name=granteePubkey,proto3" json:"granteePubkey,omitempty"`
NodeStatus NodeStatus `protobuf:"varint,4,opt,name=nodeStatus,proto3,enum=zetachain.zetacore.observer.NodeStatus" json:"nodeStatus,omitempty"`
}
func (m *NodeAccount) Reset() { *m = NodeAccount{} }
func (m *NodeAccount) String() string { return proto.CompactTextString(m) }
func (*NodeAccount) ProtoMessage() {}
func (*NodeAccount) Descriptor() ([]byte, []int) {
return fileDescriptor_6f54e38f9d1a9953, []int{0}
}
func (m *NodeAccount) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *NodeAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_NodeAccount.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *NodeAccount) XXX_Merge(src proto.Message) {
xxx_messageInfo_NodeAccount.Merge(m, src)
}
func (m *NodeAccount) XXX_Size() int {
return m.Size()
}
func (m *NodeAccount) XXX_DiscardUnknown() {
xxx_messageInfo_NodeAccount.DiscardUnknown(m)
}
var xxx_messageInfo_NodeAccount proto.InternalMessageInfo
func (m *NodeAccount) GetOperator() string {
if m != nil {
return m.Operator
}
return ""
}
func (m *NodeAccount) GetGranteeAddress() string {
if m != nil {
return m.GranteeAddress
}
return ""
}
func (m *NodeAccount) GetGranteePubkey() *common.PubKeySet {
if m != nil {
return m.GranteePubkey
}
return nil
}
func (m *NodeAccount) GetNodeStatus() NodeStatus {
if m != nil {
return m.NodeStatus
}
return NodeStatus_Unknown
}
func init() {
proto.RegisterEnum("zetachain.zetacore.observer.NodeStatus", NodeStatus_name, NodeStatus_value)
proto.RegisterType((*NodeAccount)(nil), "zetachain.zetacore.observer.NodeAccount")
}
func init() { proto.RegisterFile("observer/node_account.proto", fileDescriptor_6f54e38f9d1a9953) }
var fileDescriptor_6f54e38f9d1a9953 = []byte{
// 366 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0xcd, 0x6a, 0xdb, 0x40,
0x18, 0xd4, 0xfa, 0xaf, 0xf6, 0xaa, 0x75, 0xd5, 0x6d, 0x0f, 0x42, 0x06, 0x61, 0x7a, 0x68, 0x4d,
0xa1, 0x5a, 0x70, 0x0f, 0x3d, 0xbb, 0x14, 0x4a, 0x29, 0x18, 0x23, 0x53, 0x0a, 0xbd, 0x84, 0x5d,
0xed, 0x87, 0x2c, 0x6c, 0xef, 0x9a, 0xd5, 0xca, 0x89, 0xf2, 0x14, 0x79, 0x88, 0x1c, 0xf2, 0x28,
0x39, 0x1a, 0x72, 0xc9, 0x31, 0xd8, 0x2f, 0x12, 0x24, 0xd9, 0xce, 0xcf, 0x21, 0xa7, 0x9d, 0x9d,
0x6f, 0xbe, 0x8f, 0x19, 0x06, 0xf7, 0x14, 0x4f, 0x41, 0xaf, 0x41, 0x53, 0xa9, 0x04, 0x9c, 0xb0,
0x28, 0x52, 0x99, 0x34, 0xc1, 0x4a, 0x2b, 0xa3, 0x48, 0xef, 0x1c, 0x0c, 0x8b, 0x66, 0x2c, 0x91,
0x41, 0x89, 0x94, 0x86, 0xe0, 0xa0, 0xf7, 0xde, 0x47, 0x6a, 0xb9, 0x54, 0x92, 0x56, 0x4f, 0xb5,
0xe1, 0x7d, 0x88, 0x55, 0xac, 0x4a, 0x48, 0x0b, 0x54, 0xb1, 0x1f, 0x6f, 0x10, 0xb6, 0xc7, 0x4a,
0xc0, 0xa8, 0xba, 0x4e, 0x3c, 0xdc, 0x56, 0x2b, 0xd0, 0xcc, 0x28, 0xed, 0xa2, 0x3e, 0x1a, 0x74,
0xc2, 0xe3, 0x9f, 0x7c, 0xc2, 0xdd, 0x58, 0x33, 0x69, 0x00, 0x46, 0x42, 0x68, 0x48, 0x53, 0xb7,
0x56, 0x2a, 0x9e, 0xb1, 0xe4, 0x3b, 0x7e, 0xb3, 0x67, 0x26, 0x19, 0x9f, 0x43, 0xee, 0xd6, 0xfb,
0x68, 0x60, 0x0f, 0xdf, 0x05, 0x7b, 0x3f, 0x93, 0x8c, 0xff, 0x81, 0x7c, 0x0a, 0x26, 0x7c, 0xaa,
0x23, 0xbf, 0x30, 0x2e, 0xa2, 0x4e, 0x0d, 0x33, 0x59, 0xea, 0x36, 0xfa, 0x68, 0xd0, 0x1d, 0x7e,
0x0e, 0x5e, 0x48, 0x1a, 0x8c, 0x8f, 0xf2, 0xf0, 0xd1, 0xea, 0x17, 0x8e, 0xf1, 0xc3, 0x84, 0xd8,
0xf8, 0xd5, 0x5f, 0x39, 0x97, 0xea, 0x54, 0x3a, 0x16, 0x79, 0x8b, 0xed, 0x7f, 0xb3, 0xc4, 0xc0,
0x22, 0x49, 0x0d, 0x08, 0x07, 0x15, 0xd3, 0xa9, 0x61, 0x52, 0xf0, 0xdc, 0xa9, 0x91, 0x0e, 0x6e,
0x86, 0xc0, 0x44, 0xee, 0xd4, 0x09, 0xc6, 0xad, 0x51, 0x64, 0x92, 0x35, 0x38, 0x0d, 0xf2, 0x1a,
0xb7, 0x7f, 0x26, 0x29, 0xe3, 0x0b, 0x10, 0x4e, 0xd3, 0x6b, 0x5c, 0x5d, 0xfa, 0xe8, 0xc7, 0xef,
0xeb, 0xad, 0x8f, 0x36, 0x5b, 0x1f, 0xdd, 0x6d, 0x7d, 0x74, 0xb1, 0xf3, 0xad, 0xcd, 0xce, 0xb7,
0x6e, 0x77, 0xbe, 0xf5, 0x9f, 0xc6, 0x89, 0x99, 0x65, 0xbc, 0x88, 0x4b, 0x0b, 0xcb, 0x5f, 0x4b,
0xf7, 0xf4, 0xe0, 0x9e, 0x9e, 0xd1, 0x63, 0xb3, 0x26, 0x5f, 0x41, 0xca, 0x5b, 0x65, 0x17, 0xdf,
0xee, 0x03, 0x00, 0x00, 0xff, 0xff, 0xa7, 0x26, 0xa4, 0x08, 0xf2, 0x01, 0x00, 0x00,
}
func (m *NodeAccount) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *NodeAccount) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *NodeAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.NodeStatus != 0 {
i = encodeVarintNodeAccount(dAtA, i, uint64(m.NodeStatus))
i--
dAtA[i] = 0x20
}
if m.GranteePubkey != nil {
{
size, err := m.GranteePubkey.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintNodeAccount(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if len(m.GranteeAddress) > 0 {
i -= len(m.GranteeAddress)
copy(dAtA[i:], m.GranteeAddress)
i = encodeVarintNodeAccount(dAtA, i, uint64(len(m.GranteeAddress)))
i--
dAtA[i] = 0x12
}
if len(m.Operator) > 0 {
i -= len(m.Operator)
copy(dAtA[i:], m.Operator)
i = encodeVarintNodeAccount(dAtA, i, uint64(len(m.Operator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintNodeAccount(dAtA []byte, offset int, v uint64) int {
offset -= sovNodeAccount(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *NodeAccount) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Operator)
if l > 0 {
n += 1 + l + sovNodeAccount(uint64(l))
}
l = len(m.GranteeAddress)
if l > 0 {
n += 1 + l + sovNodeAccount(uint64(l))
}
if m.GranteePubkey != nil {
l = m.GranteePubkey.Size()
n += 1 + l + sovNodeAccount(uint64(l))
}
if m.NodeStatus != 0 {
n += 1 + sovNodeAccount(uint64(m.NodeStatus))
}
return n
}
func sovNodeAccount(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozNodeAccount(x uint64) (n int) {
return sovNodeAccount(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *NodeAccount) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: NodeAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: NodeAccount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNodeAccount
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthNodeAccount
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Operator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GranteeAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNodeAccount
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthNodeAccount
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GranteeAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GranteePubkey", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthNodeAccount
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthNodeAccount
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.GranteePubkey == nil {
m.GranteePubkey = &common.PubKeySet{}
}
if err := m.GranteePubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NodeStatus", wireType)
}
m.NodeStatus = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NodeStatus |= NodeStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipNodeAccount(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthNodeAccount
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipNodeAccount(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNodeAccount
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthNodeAccount
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupNodeAccount
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthNodeAccount
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthNodeAccount = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowNodeAccount = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupNodeAccount = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/observer.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ObservationType int32
const (
ObservationType_EmptyObserverType ObservationType = 0
ObservationType_InBoundTx ObservationType = 1
ObservationType_OutBoundTx ObservationType = 2
ObservationType_TSSKeyGen ObservationType = 3
ObservationType_TSSKeySign ObservationType = 4
)
var ObservationType_name = map[int32]string{
0: "EmptyObserverType",
1: "InBoundTx",
2: "OutBoundTx",
3: "TSSKeyGen",
4: "TSSKeySign",
}
var ObservationType_value = map[string]int32{
"EmptyObserverType": 0,
"InBoundTx": 1,
"OutBoundTx": 2,
"TSSKeyGen": 3,
"TSSKeySign": 4,
}
func (x ObservationType) String() string {
return proto.EnumName(ObservationType_name, int32(x))
}
func (ObservationType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_3004233a4a5969ce, []int{0}
}
type ObserverMapper struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
ObserverChain *common.Chain `protobuf:"bytes,2,opt,name=observer_chain,json=observerChain,proto3" json:"observer_chain,omitempty"`
ObserverList []string `protobuf:"bytes,4,rep,name=observer_list,json=observerList,proto3" json:"observer_list,omitempty"`
}
func (m *ObserverMapper) Reset() { *m = ObserverMapper{} }
func (m *ObserverMapper) String() string { return proto.CompactTextString(m) }
func (*ObserverMapper) ProtoMessage() {}
func (*ObserverMapper) Descriptor() ([]byte, []int) {
return fileDescriptor_3004233a4a5969ce, []int{0}
}
func (m *ObserverMapper) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ObserverMapper) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ObserverMapper.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ObserverMapper) XXX_Merge(src proto.Message) {
xxx_messageInfo_ObserverMapper.Merge(m, src)
}
func (m *ObserverMapper) XXX_Size() int {
return m.Size()
}
func (m *ObserverMapper) XXX_DiscardUnknown() {
xxx_messageInfo_ObserverMapper.DiscardUnknown(m)
}
var xxx_messageInfo_ObserverMapper proto.InternalMessageInfo
func (m *ObserverMapper) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
func (m *ObserverMapper) GetObserverChain() *common.Chain {
if m != nil {
return m.ObserverChain
}
return nil
}
func (m *ObserverMapper) GetObserverList() []string {
if m != nil {
return m.ObserverList
}
return nil
}
type LastObserverCount struct {
Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
LastChangeHeight int64 `protobuf:"varint,2,opt,name=last_change_height,json=lastChangeHeight,proto3" json:"last_change_height,omitempty"`
}
func (m *LastObserverCount) Reset() { *m = LastObserverCount{} }
func (m *LastObserverCount) String() string { return proto.CompactTextString(m) }
func (*LastObserverCount) ProtoMessage() {}
func (*LastObserverCount) Descriptor() ([]byte, []int) {
return fileDescriptor_3004233a4a5969ce, []int{1}
}
func (m *LastObserverCount) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LastObserverCount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LastObserverCount.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LastObserverCount) XXX_Merge(src proto.Message) {
xxx_messageInfo_LastObserverCount.Merge(m, src)
}
func (m *LastObserverCount) XXX_Size() int {
return m.Size()
}
func (m *LastObserverCount) XXX_DiscardUnknown() {
xxx_messageInfo_LastObserverCount.DiscardUnknown(m)
}
var xxx_messageInfo_LastObserverCount proto.InternalMessageInfo
func (m *LastObserverCount) GetCount() uint64 {
if m != nil {
return m.Count
}
return 0
}
func (m *LastObserverCount) GetLastChangeHeight() int64 {
if m != nil {
return m.LastChangeHeight
}
return 0
}
func init() {
proto.RegisterEnum("zetachain.zetacore.observer.ObservationType", ObservationType_name, ObservationType_value)
proto.RegisterType((*ObserverMapper)(nil), "zetachain.zetacore.observer.ObserverMapper")
proto.RegisterType((*LastObserverCount)(nil), "zetachain.zetacore.observer.LastObserverCount")
}
func init() { proto.RegisterFile("observer/observer.proto", fileDescriptor_3004233a4a5969ce) }
var fileDescriptor_3004233a4a5969ce = []byte{
// 367 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x51, 0xcf, 0x6a, 0x22, 0x31,
0x1c, 0x9e, 0xe8, 0xec, 0x82, 0xd9, 0xd5, 0x1d, 0xb3, 0x96, 0x8a, 0x85, 0x20, 0xf6, 0x22, 0xa5,
0x9d, 0x40, 0xdb, 0x27, 0x50, 0x4a, 0x2b, 0xb5, 0x08, 0xa3, 0x50, 0xe8, 0x45, 0x46, 0x0d, 0x33,
0x01, 0x4d, 0x86, 0x99, 0x4c, 0x71, 0x7a, 0xeb, 0x1b, 0xf4, 0x21, 0x7a, 0xe8, 0xa3, 0xf4, 0xe8,
0xb1, 0xc7, 0xa2, 0x2f, 0x52, 0x92, 0x18, 0x4f, 0xf9, 0xfe, 0x24, 0xf9, 0x7d, 0xfc, 0x3e, 0x78,
0x2c, 0x66, 0x19, 0x4d, 0x9f, 0x69, 0x4a, 0x2c, 0xf0, 0x93, 0x54, 0x48, 0x81, 0x4e, 0x5e, 0xa8,
0x0c, 0xe7, 0x71, 0xc8, 0xb8, 0xaf, 0x91, 0x48, 0xa9, 0x6f, 0xaf, 0xb4, 0xfe, 0xcf, 0xc5, 0x6a,
0x25, 0x38, 0x31, 0x87, 0x79, 0xd1, 0x6a, 0x44, 0x22, 0x12, 0x1a, 0x12, 0x85, 0x8c, 0xda, 0x79,
0x05, 0xb0, 0x36, 0xda, 0xbf, 0x7b, 0x08, 0x93, 0x84, 0xa6, 0xa8, 0x01, 0x7f, 0x31, 0xbe, 0xa0,
0xeb, 0x26, 0x68, 0x83, 0x6e, 0x25, 0x30, 0x04, 0x5d, 0xc3, 0x9a, 0xfd, 0x7f, 0xaa, 0xe7, 0x36,
0x4b, 0x6d, 0xd0, 0xfd, 0x73, 0x59, 0xf5, 0xf7, 0x53, 0xfa, 0x4a, 0x0c, 0xaa, 0xf6, 0x92, 0xa6,
0xe8, 0x14, 0x1e, 0x84, 0xe9, 0x92, 0x65, 0xb2, 0xe9, 0xb6, 0xcb, 0xdd, 0x4a, 0xf0, 0xd7, 0x8a,
0x43, 0x96, 0xc9, 0xce, 0x23, 0xac, 0x0f, 0xc3, 0x4c, 0xda, 0x18, 0x7d, 0x91, 0x73, 0xa9, 0x52,
0xcc, 0x15, 0xd0, 0x29, 0xdc, 0xc0, 0x10, 0x74, 0x0e, 0xd1, 0x32, 0xcc, 0xa4, 0x4a, 0xc0, 0x23,
0x3a, 0x8d, 0x29, 0x8b, 0x62, 0xa9, 0x93, 0x94, 0x03, 0x4f, 0x39, 0x7d, 0x6d, 0xdc, 0x69, 0xfd,
0x6c, 0x09, 0xff, 0x99, 0x4f, 0x43, 0xc9, 0x04, 0x9f, 0x14, 0x09, 0x45, 0x47, 0xb0, 0x7e, 0xb3,
0x4a, 0x64, 0x61, 0x87, 0x29, 0xd1, 0x73, 0x50, 0x15, 0x56, 0x06, 0xbc, 0x27, 0x72, 0xbe, 0x98,
0xac, 0x3d, 0x80, 0x6a, 0x10, 0x8e, 0x72, 0x69, 0x79, 0x49, 0xd9, 0x93, 0xf1, 0xf8, 0x9e, 0x16,
0xb7, 0x94, 0x7b, 0x65, 0x65, 0x1b, 0x3a, 0x66, 0x11, 0xf7, 0xdc, 0x96, 0xfb, 0xf1, 0x8e, 0x41,
0x6f, 0xf0, 0xb9, 0xc5, 0x60, 0xb3, 0xc5, 0xe0, 0x7b, 0x8b, 0xc1, 0xdb, 0x0e, 0x3b, 0x9b, 0x1d,
0x76, 0xbe, 0x76, 0xd8, 0x79, 0x22, 0x11, 0x93, 0x71, 0x3e, 0x53, 0x9b, 0x22, 0xaa, 0xad, 0x0b,
0xbd, 0x40, 0x62, 0x8b, 0x23, 0xeb, 0x43, 0xbb, 0x44, 0x16, 0x09, 0xcd, 0x66, 0xbf, 0x75, 0x39,
0x57, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xad, 0xb9, 0x91, 0xff, 0x01, 0x00, 0x00,
}
func (m *ObserverMapper) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ObserverMapper) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ObserverMapper) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ObserverList) > 0 {
for iNdEx := len(m.ObserverList) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.ObserverList[iNdEx])
copy(dAtA[i:], m.ObserverList[iNdEx])
i = encodeVarintObserver(dAtA, i, uint64(len(m.ObserverList[iNdEx])))
i--
dAtA[i] = 0x22
}
}
if m.ObserverChain != nil {
{
size, err := m.ObserverChain.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintObserver(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintObserver(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *LastObserverCount) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *LastObserverCount) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LastObserverCount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.LastChangeHeight != 0 {
i = encodeVarintObserver(dAtA, i, uint64(m.LastChangeHeight))
i--
dAtA[i] = 0x10
}
if m.Count != 0 {
i = encodeVarintObserver(dAtA, i, uint64(m.Count))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintObserver(dAtA []byte, offset int, v uint64) int {
offset -= sovObserver(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *ObserverMapper) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovObserver(uint64(l))
}
if m.ObserverChain != nil {
l = m.ObserverChain.Size()
n += 1 + l + sovObserver(uint64(l))
}
if len(m.ObserverList) > 0 {
for _, s := range m.ObserverList {
l = len(s)
n += 1 + l + sovObserver(uint64(l))
}
}
return n
}
func (m *LastObserverCount) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Count != 0 {
n += 1 + sovObserver(uint64(m.Count))
}
if m.LastChangeHeight != 0 {
n += 1 + sovObserver(uint64(m.LastChangeHeight))
}
return n
}
func sovObserver(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozObserver(x uint64) (n int) {
return sovObserver(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *ObserverMapper) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObserver
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ObserverMapper: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ObserverMapper: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObserver
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthObserver
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthObserver
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverChain", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObserver
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthObserver
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthObserver
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ObserverChain == nil {
m.ObserverChain = &common.Chain{}
}
if err := m.ObserverChain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverList", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObserver
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthObserver
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthObserver
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverList = append(m.ObserverList, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipObserver(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthObserver
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *LastObserverCount) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObserver
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: LastObserverCount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LastObserverCount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType)
}
m.Count = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObserver
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Count |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastChangeHeight", wireType)
}
m.LastChangeHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObserver
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LastChangeHeight |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipObserver(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthObserver
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipObserver(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowObserver
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowObserver
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowObserver
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthObserver
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupObserver
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthObserver
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthObserver = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowObserver = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupObserver = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
"errors"
"fmt"
"github.com/zeta-chain/zetacore/common"
)
// Validate observer mapper contains an existing chain
func (m *ObserverMapper) Validate() error {
if m.ObserverChain == nil {
return errors.New("observer chain is not set")
}
chains := common.DefaultChainsList()
for _, chain := range chains {
if *m.ObserverChain == *chain {
return nil
}
}
return fmt.Errorf("observer chain %d doesn't exist: ", m.ObserverChain.ChainName)
}
// VerifyObserverMapper verifies list of observer mappers
func VerifyObserverMapper(obs []*ObserverMapper) error {
for _, mapper := range obs {
if mapper != nil {
err := mapper.Validate()
if err != nil {
return fmt.Errorf("observer mapper %s is invalid: %s", mapper.String(), err.Error())
}
}
}
return nil
}
func CheckReceiveStatus(status common.ReceiveStatus) error {
switch status {
case common.ReceiveStatus_Success:
return nil
case common.ReceiveStatus_Failed:
return nil
default:
return ErrInvalidStatus
}
}
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/zeta-chain/zetacore/common"
"gopkg.in/yaml.v2"
)
var _ paramtypes.ParamSet = (*Params)(nil)
// ParamKeyTable the param key table for zetaObserver module
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}
func NewParams(observerParams []*ObserverParams, adminParams []*Admin_Policy, ballotMaturityBlocks int64) Params {
return Params{ObserverParams: observerParams, AdminPolicy: adminParams, BallotMaturityBlocks: ballotMaturityBlocks}
}
func DefaultParams() Params {
chains := common.DefaultChainsList()
observerParams := make([]*ObserverParams, len(chains))
for i, chain := range chains {
observerParams[i] = &ObserverParams{
IsSupported: true,
Chain: chain,
BallotThreshold: sdk.MustNewDecFromStr("0.66"),
MinObserverDelegation: sdk.MustNewDecFromStr("1000000000000000000000"), // 1000 ZETA
}
}
return NewParams(observerParams, DefaultAdminPolicy(), 100)
}
func DefaultAdminPolicy() []*Admin_Policy {
return []*Admin_Policy{
{
PolicyType: Policy_Type_group1,
Address: GroupID1Address,
},
{
PolicyType: Policy_Type_group2,
Address: GroupID1Address,
},
}
}
// ParamSetPairs get the params.ParamSet
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(KeyPrefix(ObserverParamsKey), &p.ObserverParams, validateVotingThresholds),
paramtypes.NewParamSetPair(KeyPrefix(AdminPolicyParamsKey), &p.AdminPolicy, validateAdminPolicy),
paramtypes.NewParamSetPair(KeyPrefix(BallotMaturityBlocksParamsKey), &p.BallotMaturityBlocks, validateBallotMaturityBlocks),
}
}
// Validate validates the set of params
func (p Params) Validate() error {
return nil
}
// String implements the Stringer interface.
func (p Params) String() string {
out, err := yaml.Marshal(p)
if err != nil {
return ""
}
return string(out)
}
func validateVotingThresholds(i interface{}) error {
v, ok := i.([]*ObserverParams)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
for _, threshold := range v {
if threshold.BallotThreshold.GT(sdk.OneDec()) {
return ErrParamsThreshold
}
}
return nil
}
func validateAdminPolicy(i interface{}) error {
_, ok := i.([]*Admin_Policy)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}
func validateBallotMaturityBlocks(i interface{}) error {
_, ok := i.(int64)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}
func (p Params) GetAdminPolicyAccount(policyType Policy_Type) string {
for _, admin := range p.AdminPolicy {
if admin.PolicyType == policyType {
return admin.Address
}
}
return ""
}
func (p Params) GetParamsForChain(chain *common.Chain) ObserverParams {
for _, ObserverParam := range p.GetObserverParams() {
if ObserverParam.Chain.IsEqual(*chain) {
return *ObserverParam
}
}
return ObserverParams{}
}
func (p Params) GetParamsForChainID(chainID int64) ObserverParams {
for _, ObserverParam := range p.GetObserverParams() {
if ObserverParam.Chain.ChainId == chainID {
return *ObserverParam
}
}
return ObserverParams{}
}
func (p Params) GetSupportedChains() (chains []*common.Chain) {
for _, observerParam := range p.GetObserverParams() {
if observerParam.IsSupported {
chains = append(chains, observerParam.Chain)
}
}
return
}
func (p Params) GetChainFromChainID(chainID int64) *common.Chain {
for _, observerParam := range p.GetObserverParams() {
if observerParam.Chain.ChainId == chainID && observerParam.IsSupported {
return observerParam.Chain
}
}
return nil
}
func (p Params) GetChainFromChainName(name common.ChainName) *common.Chain {
for _, observerParam := range p.GetObserverParams() {
if observerParam.Chain.ChainName == name && observerParam.IsSupported {
return observerParam.Chain
}
}
return nil
}
func (p Params) IsChainSupported(checkChain common.Chain) bool {
chains := p.GetSupportedChains()
for _, chain := range chains {
if checkChain.IsEqual(*chain) {
return true
}
}
return false
}
func (p Params) IsChainIDSupported(checkChainID int64) bool {
chains := p.GetSupportedChains()
for _, chain := range chains {
if chain.ChainId == checkChainID {
return true
}
}
return false
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/params.proto
package types
import (
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Policy_Type int32
const (
Policy_Type_group1 Policy_Type = 0
Policy_Type_group2 Policy_Type = 1
)
var Policy_Type_name = map[int32]string{
0: "group1",
1: "group2",
}
var Policy_Type_value = map[string]int32{
"group1": 0,
"group2": 1,
}
func (x Policy_Type) String() string {
return proto.EnumName(Policy_Type_name, int32(x))
}
func (Policy_Type) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_4542fa62877488a1, []int{0}
}
type CoreParamsList struct {
CoreParams []*CoreParams `protobuf:"bytes,1,rep,name=core_params,json=coreParams,proto3" json:"core_params,omitempty"`
}
func (m *CoreParamsList) Reset() { *m = CoreParamsList{} }
func (m *CoreParamsList) String() string { return proto.CompactTextString(m) }
func (*CoreParamsList) ProtoMessage() {}
func (*CoreParamsList) Descriptor() ([]byte, []int) {
return fileDescriptor_4542fa62877488a1, []int{0}
}
func (m *CoreParamsList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *CoreParamsList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_CoreParamsList.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *CoreParamsList) XXX_Merge(src proto.Message) {
xxx_messageInfo_CoreParamsList.Merge(m, src)
}
func (m *CoreParamsList) XXX_Size() int {
return m.Size()
}
func (m *CoreParamsList) XXX_DiscardUnknown() {
xxx_messageInfo_CoreParamsList.DiscardUnknown(m)
}
var xxx_messageInfo_CoreParamsList proto.InternalMessageInfo
func (m *CoreParamsList) GetCoreParams() []*CoreParams {
if m != nil {
return m.CoreParams
}
return nil
}
type CoreParams struct {
ConfirmationCount uint64 `protobuf:"varint,1,opt,name=confirmation_count,json=confirmationCount,proto3" json:"confirmation_count,omitempty"`
GasPriceTicker uint64 `protobuf:"varint,2,opt,name=gas_price_ticker,json=gasPriceTicker,proto3" json:"gas_price_ticker,omitempty"`
InTxTicker uint64 `protobuf:"varint,3,opt,name=in_tx_ticker,json=inTxTicker,proto3" json:"in_tx_ticker,omitempty"`
OutTxTicker uint64 `protobuf:"varint,4,opt,name=out_tx_ticker,json=outTxTicker,proto3" json:"out_tx_ticker,omitempty"`
WatchUtxoTicker uint64 `protobuf:"varint,5,opt,name=watch_utxo_ticker,json=watchUtxoTicker,proto3" json:"watch_utxo_ticker,omitempty"`
ZetaTokenContractAddress string `protobuf:"bytes,8,opt,name=zeta_token_contract_address,json=zetaTokenContractAddress,proto3" json:"zeta_token_contract_address,omitempty"`
ConnectorContractAddress string `protobuf:"bytes,9,opt,name=connector_contract_address,json=connectorContractAddress,proto3" json:"connector_contract_address,omitempty"`
Erc20CustodyContractAddress string `protobuf:"bytes,10,opt,name=erc20_custody_contract_address,json=erc20CustodyContractAddress,proto3" json:"erc20_custody_contract_address,omitempty"`
ChainId int64 `protobuf:"varint,11,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
OutboundTxScheduleInterval int64 `protobuf:"varint,12,opt,name=outbound_tx_schedule_interval,json=outboundTxScheduleInterval,proto3" json:"outbound_tx_schedule_interval,omitempty"`
OutboundTxScheduleLookahead int64 `protobuf:"varint,13,opt,name=outbound_tx_schedule_lookahead,json=outboundTxScheduleLookahead,proto3" json:"outbound_tx_schedule_lookahead,omitempty"`
}
func (m *CoreParams) Reset() { *m = CoreParams{} }
func (m *CoreParams) String() string { return proto.CompactTextString(m) }
func (*CoreParams) ProtoMessage() {}
func (*CoreParams) Descriptor() ([]byte, []int) {
return fileDescriptor_4542fa62877488a1, []int{1}
}
func (m *CoreParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *CoreParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_CoreParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *CoreParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_CoreParams.Merge(m, src)
}
func (m *CoreParams) XXX_Size() int {
return m.Size()
}
func (m *CoreParams) XXX_DiscardUnknown() {
xxx_messageInfo_CoreParams.DiscardUnknown(m)
}
var xxx_messageInfo_CoreParams proto.InternalMessageInfo
func (m *CoreParams) GetConfirmationCount() uint64 {
if m != nil {
return m.ConfirmationCount
}
return 0
}
func (m *CoreParams) GetGasPriceTicker() uint64 {
if m != nil {
return m.GasPriceTicker
}
return 0
}
func (m *CoreParams) GetInTxTicker() uint64 {
if m != nil {
return m.InTxTicker
}
return 0
}
func (m *CoreParams) GetOutTxTicker() uint64 {
if m != nil {
return m.OutTxTicker
}
return 0
}
func (m *CoreParams) GetWatchUtxoTicker() uint64 {
if m != nil {
return m.WatchUtxoTicker
}
return 0
}
func (m *CoreParams) GetZetaTokenContractAddress() string {
if m != nil {
return m.ZetaTokenContractAddress
}
return ""
}
func (m *CoreParams) GetConnectorContractAddress() string {
if m != nil {
return m.ConnectorContractAddress
}
return ""
}
func (m *CoreParams) GetErc20CustodyContractAddress() string {
if m != nil {
return m.Erc20CustodyContractAddress
}
return ""
}
func (m *CoreParams) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *CoreParams) GetOutboundTxScheduleInterval() int64 {
if m != nil {
return m.OutboundTxScheduleInterval
}
return 0
}
func (m *CoreParams) GetOutboundTxScheduleLookahead() int64 {
if m != nil {
return m.OutboundTxScheduleLookahead
}
return 0
}
type ObserverParams struct {
Chain *common.Chain `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"`
BallotThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=ballot_threshold,json=ballotThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"ballot_threshold"`
MinObserverDelegation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=min_observer_delegation,json=minObserverDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_observer_delegation"`
IsSupported bool `protobuf:"varint,5,opt,name=is_supported,json=isSupported,proto3" json:"is_supported,omitempty"`
}
func (m *ObserverParams) Reset() { *m = ObserverParams{} }
func (m *ObserverParams) String() string { return proto.CompactTextString(m) }
func (*ObserverParams) ProtoMessage() {}
func (*ObserverParams) Descriptor() ([]byte, []int) {
return fileDescriptor_4542fa62877488a1, []int{2}
}
func (m *ObserverParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ObserverParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ObserverParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ObserverParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_ObserverParams.Merge(m, src)
}
func (m *ObserverParams) XXX_Size() int {
return m.Size()
}
func (m *ObserverParams) XXX_DiscardUnknown() {
xxx_messageInfo_ObserverParams.DiscardUnknown(m)
}
var xxx_messageInfo_ObserverParams proto.InternalMessageInfo
func (m *ObserverParams) GetChain() *common.Chain {
if m != nil {
return m.Chain
}
return nil
}
func (m *ObserverParams) GetIsSupported() bool {
if m != nil {
return m.IsSupported
}
return false
}
type Admin_Policy struct {
PolicyType Policy_Type `protobuf:"varint,1,opt,name=policy_type,json=policyType,proto3,enum=zetachain.zetacore.observer.Policy_Type" json:"policy_type,omitempty"`
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
}
func (m *Admin_Policy) Reset() { *m = Admin_Policy{} }
func (m *Admin_Policy) String() string { return proto.CompactTextString(m) }
func (*Admin_Policy) ProtoMessage() {}
func (*Admin_Policy) Descriptor() ([]byte, []int) {
return fileDescriptor_4542fa62877488a1, []int{3}
}
func (m *Admin_Policy) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Admin_Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Admin_Policy.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Admin_Policy) XXX_Merge(src proto.Message) {
xxx_messageInfo_Admin_Policy.Merge(m, src)
}
func (m *Admin_Policy) XXX_Size() int {
return m.Size()
}
func (m *Admin_Policy) XXX_DiscardUnknown() {
xxx_messageInfo_Admin_Policy.DiscardUnknown(m)
}
var xxx_messageInfo_Admin_Policy proto.InternalMessageInfo
func (m *Admin_Policy) GetPolicyType() Policy_Type {
if m != nil {
return m.PolicyType
}
return Policy_Type_group1
}
func (m *Admin_Policy) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
// Params defines the parameters for the module.
type Params struct {
ObserverParams []*ObserverParams `protobuf:"bytes,1,rep,name=observer_params,json=observerParams,proto3" json:"observer_params,omitempty"`
AdminPolicy []*Admin_Policy `protobuf:"bytes,2,rep,name=admin_policy,json=adminPolicy,proto3" json:"admin_policy,omitempty"`
BallotMaturityBlocks int64 `protobuf:"varint,3,opt,name=ballot_maturity_blocks,json=ballotMaturityBlocks,proto3" json:"ballot_maturity_blocks,omitempty"`
}
func (m *Params) Reset() { *m = Params{} }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_4542fa62877488a1, []int{4}
}
func (m *Params) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Params) XXX_Merge(src proto.Message) {
xxx_messageInfo_Params.Merge(m, src)
}
func (m *Params) XXX_Size() int {
return m.Size()
}
func (m *Params) XXX_DiscardUnknown() {
xxx_messageInfo_Params.DiscardUnknown(m)
}
var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetObserverParams() []*ObserverParams {
if m != nil {
return m.ObserverParams
}
return nil
}
func (m *Params) GetAdminPolicy() []*Admin_Policy {
if m != nil {
return m.AdminPolicy
}
return nil
}
func (m *Params) GetBallotMaturityBlocks() int64 {
if m != nil {
return m.BallotMaturityBlocks
}
return 0
}
func init() {
proto.RegisterEnum("zetachain.zetacore.observer.Policy_Type", Policy_Type_name, Policy_Type_value)
proto.RegisterType((*CoreParamsList)(nil), "zetachain.zetacore.observer.CoreParamsList")
proto.RegisterType((*CoreParams)(nil), "zetachain.zetacore.observer.CoreParams")
proto.RegisterType((*ObserverParams)(nil), "zetachain.zetacore.observer.ObserverParams")
proto.RegisterType((*Admin_Policy)(nil), "zetachain.zetacore.observer.Admin_Policy")
proto.RegisterType((*Params)(nil), "zetachain.zetacore.observer.Params")
}
func init() { proto.RegisterFile("observer/params.proto", fileDescriptor_4542fa62877488a1) }
var fileDescriptor_4542fa62877488a1 = []byte{
// 792 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6f, 0x1b, 0x45,
0x14, 0xc7, 0xbd, 0x89, 0x9b, 0x26, 0x6f, 0x1d, 0x27, 0x5d, 0x5a, 0xba, 0x38, 0xc2, 0x31, 0x46,
0x02, 0xd3, 0x2a, 0x36, 0x18, 0x4e, 0x08, 0x0e, 0x89, 0x7b, 0x20, 0x52, 0x10, 0xd1, 0xd6, 0x1c,
0xe8, 0x65, 0x34, 0x9e, 0x9d, 0xda, 0x23, 0xaf, 0xf7, 0xad, 0x66, 0x66, 0x8b, 0xcd, 0x5f, 0xc1,
0x11, 0x89, 0x0b, 0x07, 0x0e, 0xfc, 0x11, 0xfc, 0x01, 0x3d, 0xf6, 0x88, 0x38, 0x54, 0x28, 0xb9,
0xf0, 0x67, 0xa0, 0x7d, 0xfb, 0xa3, 0x4e, 0x82, 0x22, 0xf5, 0xe4, 0xb7, 0xf3, 0x3e, 0xef, 0x3b,
0x6f, 0xde, 0x7c, 0x3d, 0xf0, 0x00, 0x27, 0x46, 0xea, 0x17, 0x52, 0x0f, 0x12, 0xae, 0xf9, 0xc2,
0xf4, 0x13, 0x8d, 0x16, 0xbd, 0x83, 0x9f, 0xa4, 0xe5, 0x62, 0xc6, 0x55, 0xdc, 0xa7, 0x08, 0xb5,
0xec, 0x97, 0x64, 0xeb, 0x1d, 0x81, 0x8b, 0x05, 0xc6, 0x83, 0xfc, 0x27, 0xaf, 0x68, 0xdd, 0x9f,
0xe2, 0x14, 0x29, 0x1c, 0x64, 0x51, 0xb1, 0xfa, 0xb0, 0x92, 0x2f, 0x83, 0x3c, 0xd1, 0x7d, 0x06,
0xcd, 0x11, 0x6a, 0x79, 0x4e, 0x9b, 0x9e, 0x29, 0x63, 0xbd, 0x6f, 0xc0, 0xcd, 0xb6, 0x61, 0x79,
0x1f, 0xbe, 0xd3, 0xd9, 0xec, 0xb9, 0xc3, 0x8f, 0xfb, 0xb7, 0x34, 0xd2, 0x7f, 0xa3, 0x10, 0x80,
0xa8, 0xe2, 0xee, 0x9f, 0x75, 0x80, 0x37, 0x29, 0xef, 0x08, 0x3c, 0x81, 0xf1, 0x73, 0xa5, 0x17,
0xdc, 0x2a, 0x8c, 0x99, 0xc0, 0x34, 0xb6, 0xbe, 0xd3, 0x71, 0x7a, 0xf5, 0xe0, 0xde, 0x7a, 0x66,
0x94, 0x25, 0xbc, 0x1e, 0xec, 0x4f, 0xb9, 0x61, 0x89, 0x56, 0x42, 0x32, 0xab, 0xc4, 0x5c, 0x6a,
0x7f, 0x83, 0xe0, 0xe6, 0x94, 0x9b, 0xf3, 0x6c, 0x79, 0x4c, 0xab, 0x5e, 0x07, 0x1a, 0x2a, 0x66,
0x76, 0x59, 0x52, 0x9b, 0x44, 0x81, 0x8a, 0xc7, 0xcb, 0x82, 0xe8, 0xc2, 0x2e, 0xa6, 0x76, 0x0d,
0xa9, 0x13, 0xe2, 0x62, 0x6a, 0x2b, 0xe6, 0x11, 0xdc, 0xfb, 0x91, 0x5b, 0x31, 0x63, 0xa9, 0x5d,
0x62, 0xc9, 0xdd, 0x21, 0x6e, 0x8f, 0x12, 0xdf, 0xdb, 0x25, 0x16, 0xec, 0xd7, 0x40, 0x17, 0xc3,
0x2c, 0xce, 0x65, 0x76, 0x90, 0xd8, 0x6a, 0x2e, 0x2c, 0xe3, 0x61, 0xa8, 0xa5, 0x31, 0xfe, 0x76,
0xc7, 0xe9, 0xed, 0x04, 0x7e, 0x86, 0x8c, 0x33, 0x62, 0x54, 0x00, 0xc7, 0x79, 0xde, 0xfb, 0x0a,
0x5a, 0x02, 0xe3, 0x58, 0x0a, 0x8b, 0xfa, 0x66, 0xf5, 0x4e, 0x5e, 0x5d, 0x11, 0xd7, 0xab, 0x47,
0xd0, 0x96, 0x5a, 0x0c, 0x3f, 0x65, 0x22, 0x35, 0x16, 0xc3, 0xd5, 0x4d, 0x05, 0x20, 0x85, 0x03,
0xa2, 0x46, 0x39, 0x74, 0x5d, 0xe4, 0x3d, 0xd8, 0xa6, 0xdb, 0x64, 0x2a, 0xf4, 0xdd, 0x8e, 0xd3,
0xdb, 0x0c, 0xee, 0xd2, 0xf7, 0x69, 0xe8, 0x1d, 0xc3, 0xfb, 0x98, 0xda, 0x09, 0xa6, 0x71, 0x98,
0x4d, 0xcc, 0x88, 0x99, 0x0c, 0xd3, 0x48, 0x32, 0x15, 0x5b, 0xa9, 0x5f, 0xf0, 0xc8, 0x6f, 0x10,
0xdf, 0x2a, 0xa1, 0xf1, 0xf2, 0x69, 0x81, 0x9c, 0x16, 0x44, 0xd6, 0xe2, 0xff, 0x4a, 0x44, 0x88,
0x73, 0x3e, 0x93, 0x3c, 0xf4, 0x77, 0x49, 0xe3, 0xe0, 0xa6, 0xc6, 0x59, 0x89, 0x74, 0x7f, 0xdd,
0x80, 0xe6, 0x77, 0x85, 0xc5, 0x0a, 0x0b, 0x7d, 0x08, 0x77, 0xa8, 0x4b, 0x72, 0x8d, 0x3b, 0xdc,
0xed, 0x17, 0xd6, 0x1f, 0x65, 0x8b, 0x41, 0x9e, 0xf3, 0x7e, 0x80, 0xfd, 0x09, 0x8f, 0x22, 0xb4,
0xcc, 0xce, 0xb4, 0x34, 0x33, 0x8c, 0x42, 0xb2, 0xc4, 0xce, 0x49, 0xff, 0xe5, 0xeb, 0xc3, 0xda,
0xdf, 0xaf, 0x0f, 0x3f, 0x9a, 0x2a, 0x3b, 0x4b, 0x27, 0x59, 0xf5, 0x40, 0xa0, 0x59, 0xa0, 0x29,
0x7e, 0x8e, 0x4c, 0x38, 0x1f, 0xd8, 0x55, 0x22, 0x4d, 0xff, 0x89, 0x14, 0xc1, 0x5e, 0xae, 0x33,
0x2e, 0x65, 0xbc, 0xe7, 0xf0, 0x70, 0xa1, 0x62, 0x56, 0x1a, 0x9f, 0x85, 0x32, 0x92, 0x53, 0xf2,
0x2c, 0x39, 0xea, 0xed, 0x77, 0x78, 0xb0, 0x50, 0x71, 0x79, 0xc6, 0x27, 0x95, 0x98, 0xf7, 0x01,
0x34, 0x94, 0x61, 0x26, 0x4d, 0x12, 0xd4, 0x56, 0x86, 0x64, 0xc3, 0xed, 0xc0, 0x55, 0xe6, 0x69,
0xb9, 0xd4, 0x35, 0xd0, 0x38, 0x0e, 0xb3, 0x66, 0xce, 0x31, 0x52, 0x62, 0xe5, 0x9d, 0x82, 0x9b,
0x50, 0xc4, 0x32, 0x75, 0x1a, 0x50, 0x73, 0xd8, 0xbb, 0xf5, 0x6f, 0x9b, 0x57, 0xb2, 0xf1, 0x2a,
0x91, 0x01, 0xe4, 0xc5, 0x59, 0xec, 0xf9, 0x70, 0xb7, 0x74, 0xd2, 0x06, 0x39, 0xa9, 0xfc, 0xec,
0xfe, 0xeb, 0xc0, 0x56, 0x71, 0x15, 0x63, 0xd8, 0xab, 0xc6, 0x70, 0xe5, 0xa9, 0x78, 0x7c, 0xeb,
0x9e, 0x57, 0x2f, 0x34, 0x68, 0xe2, 0xd5, 0x0b, 0x3e, 0x83, 0x06, 0xa7, 0x53, 0xe5, 0xed, 0xf8,
0x1b, 0x24, 0xf9, 0xc9, 0xad, 0x92, 0xeb, 0x63, 0x08, 0x5c, 0x2a, 0x2f, 0x66, 0xf2, 0x05, 0xbc,
0x5b, 0x38, 0x61, 0xc1, 0x6d, 0xaa, 0x95, 0x5d, 0xb1, 0x49, 0x84, 0x62, 0x6e, 0xc8, 0x0f, 0x9b,
0xc1, 0xfd, 0x3c, 0xfb, 0x6d, 0x91, 0x3c, 0xa1, 0xdc, 0x97, 0xf5, 0x5f, 0x7e, 0x3b, 0xac, 0x3d,
0x7a, 0x0c, 0xee, 0xda, 0x7c, 0x3c, 0x80, 0xad, 0xa9, 0xc6, 0x34, 0xf9, 0x6c, 0xbf, 0x56, 0xc5,
0xc3, 0x7d, 0xa7, 0x55, 0xff, 0xe3, 0xf7, 0xb6, 0x73, 0x72, 0xfa, 0xf2, 0xa2, 0xed, 0xbc, 0xba,
0x68, 0x3b, 0xff, 0x5c, 0xb4, 0x9d, 0x9f, 0x2f, 0xdb, 0xb5, 0x57, 0x97, 0xed, 0xda, 0x5f, 0x97,
0xed, 0xda, 0xb3, 0xc1, 0x9a, 0x11, 0xb2, 0xd6, 0x8f, 0xe8, 0x14, 0x83, 0xf2, 0x14, 0x83, 0x65,
0xf5, 0x20, 0xe7, 0xae, 0x98, 0x6c, 0xd1, 0xbb, 0xfc, 0xf9, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff,
0x7f, 0x57, 0xd8, 0xba, 0x11, 0x06, 0x00, 0x00,
}
func (m *CoreParamsList) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CoreParamsList) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CoreParamsList) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.CoreParams) > 0 {
for iNdEx := len(m.CoreParams) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.CoreParams[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *CoreParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CoreParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CoreParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.OutboundTxScheduleLookahead != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.OutboundTxScheduleLookahead))
i--
dAtA[i] = 0x68
}
if m.OutboundTxScheduleInterval != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.OutboundTxScheduleInterval))
i--
dAtA[i] = 0x60
}
if m.ChainId != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x58
}
if len(m.Erc20CustodyContractAddress) > 0 {
i -= len(m.Erc20CustodyContractAddress)
copy(dAtA[i:], m.Erc20CustodyContractAddress)
i = encodeVarintParams(dAtA, i, uint64(len(m.Erc20CustodyContractAddress)))
i--
dAtA[i] = 0x52
}
if len(m.ConnectorContractAddress) > 0 {
i -= len(m.ConnectorContractAddress)
copy(dAtA[i:], m.ConnectorContractAddress)
i = encodeVarintParams(dAtA, i, uint64(len(m.ConnectorContractAddress)))
i--
dAtA[i] = 0x4a
}
if len(m.ZetaTokenContractAddress) > 0 {
i -= len(m.ZetaTokenContractAddress)
copy(dAtA[i:], m.ZetaTokenContractAddress)
i = encodeVarintParams(dAtA, i, uint64(len(m.ZetaTokenContractAddress)))
i--
dAtA[i] = 0x42
}
if m.WatchUtxoTicker != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.WatchUtxoTicker))
i--
dAtA[i] = 0x28
}
if m.OutTxTicker != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.OutTxTicker))
i--
dAtA[i] = 0x20
}
if m.InTxTicker != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.InTxTicker))
i--
dAtA[i] = 0x18
}
if m.GasPriceTicker != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.GasPriceTicker))
i--
dAtA[i] = 0x10
}
if m.ConfirmationCount != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.ConfirmationCount))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *ObserverParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ObserverParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ObserverParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.IsSupported {
i--
if m.IsSupported {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x28
}
{
size := m.MinObserverDelegation.Size()
i -= size
if _, err := m.MinObserverDelegation.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
{
size := m.BallotThreshold.Size()
i -= size
if _, err := m.BallotThreshold.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if m.Chain != nil {
{
size, err := m.Chain.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Admin_Policy) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Admin_Policy) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Admin_Policy) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintParams(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0x12
}
if m.PolicyType != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.PolicyType))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *Params) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BallotMaturityBlocks != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.BallotMaturityBlocks))
i--
dAtA[i] = 0x18
}
if len(m.AdminPolicy) > 0 {
for iNdEx := len(m.AdminPolicy) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.AdminPolicy[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.ObserverParams) > 0 {
for iNdEx := len(m.ObserverParams) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.ObserverParams[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintParams(dAtA []byte, offset int, v uint64) int {
offset -= sovParams(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *CoreParamsList) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.CoreParams) > 0 {
for _, e := range m.CoreParams {
l = e.Size()
n += 1 + l + sovParams(uint64(l))
}
}
return n
}
func (m *CoreParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ConfirmationCount != 0 {
n += 1 + sovParams(uint64(m.ConfirmationCount))
}
if m.GasPriceTicker != 0 {
n += 1 + sovParams(uint64(m.GasPriceTicker))
}
if m.InTxTicker != 0 {
n += 1 + sovParams(uint64(m.InTxTicker))
}
if m.OutTxTicker != 0 {
n += 1 + sovParams(uint64(m.OutTxTicker))
}
if m.WatchUtxoTicker != 0 {
n += 1 + sovParams(uint64(m.WatchUtxoTicker))
}
l = len(m.ZetaTokenContractAddress)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.ConnectorContractAddress)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = len(m.Erc20CustodyContractAddress)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovParams(uint64(m.ChainId))
}
if m.OutboundTxScheduleInterval != 0 {
n += 1 + sovParams(uint64(m.OutboundTxScheduleInterval))
}
if m.OutboundTxScheduleLookahead != 0 {
n += 1 + sovParams(uint64(m.OutboundTxScheduleLookahead))
}
return n
}
func (m *ObserverParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Chain != nil {
l = m.Chain.Size()
n += 1 + l + sovParams(uint64(l))
}
l = m.BallotThreshold.Size()
n += 1 + l + sovParams(uint64(l))
l = m.MinObserverDelegation.Size()
n += 1 + l + sovParams(uint64(l))
if m.IsSupported {
n += 2
}
return n
}
func (m *Admin_Policy) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.PolicyType != 0 {
n += 1 + sovParams(uint64(m.PolicyType))
}
l = len(m.Address)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
return n
}
func (m *Params) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.ObserverParams) > 0 {
for _, e := range m.ObserverParams {
l = e.Size()
n += 1 + l + sovParams(uint64(l))
}
}
if len(m.AdminPolicy) > 0 {
for _, e := range m.AdminPolicy {
l = e.Size()
n += 1 + l + sovParams(uint64(l))
}
}
if m.BallotMaturityBlocks != 0 {
n += 1 + sovParams(uint64(m.BallotMaturityBlocks))
}
return n
}
func sovParams(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozParams(x uint64) (n int) {
return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *CoreParamsList) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: CoreParamsList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: CoreParamsList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CoreParams = append(m.CoreParams, &CoreParams{})
if err := m.CoreParams[len(m.CoreParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *CoreParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: CoreParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: CoreParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ConfirmationCount", wireType)
}
m.ConfirmationCount = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ConfirmationCount |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceTicker", wireType)
}
m.GasPriceTicker = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GasPriceTicker |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field InTxTicker", wireType)
}
m.InTxTicker = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.InTxTicker |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutTxTicker", wireType)
}
m.OutTxTicker = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutTxTicker |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field WatchUtxoTicker", wireType)
}
m.WatchUtxoTicker = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.WatchUtxoTicker |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ZetaTokenContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ZetaTokenContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ConnectorContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ConnectorContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Erc20CustodyContractAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Erc20CustodyContractAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 11:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 12:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxScheduleInterval", wireType)
}
m.OutboundTxScheduleInterval = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutboundTxScheduleInterval |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 13:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxScheduleLookahead", wireType)
}
m.OutboundTxScheduleLookahead = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OutboundTxScheduleLookahead |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ObserverParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ObserverParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ObserverParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Chain == nil {
m.Chain = &common.Chain{}
}
if err := m.Chain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotThreshold", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.BallotThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinObserverDelegation", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MinObserverDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsSupported", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsSupported = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Admin_Policy) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Admin_Policy: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Admin_Policy: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field PolicyType", wireType)
}
m.PolicyType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.PolicyType |= Policy_Type(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Params) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Params: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverParams = append(m.ObserverParams, &ObserverParams{})
if err := m.ObserverParams[len(m.ObserverParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AdminPolicy", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AdminPolicy = append(m.AdminPolicy, &Admin_Policy{})
if err := m.AdminPolicy[len(m.AdminPolicy)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotMaturityBlocks", wireType)
}
m.BallotMaturityBlocks = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BallotMaturityBlocks |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipParams(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowParams
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthParams
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupParams
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthParams
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowParams = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
)
func ConvertReceiveStatusToVoteType(status common.ReceiveStatus) VoteType {
switch status {
case common.ReceiveStatus_Success:
return VoteType_SuccessObservation
case common.ReceiveStatus_Failed:
return VoteType_FailureObservation
default:
return VoteType_NotYetVoted
}
}
func ParseStringToObservationType(observationType string) ObservationType {
c := ObservationType_value[observationType]
return ObservationType(c)
}
func GetOperatorAddressFromAccAddress(accAddr string) (sdk.ValAddress, error) {
accAddressBech32, err := sdk.AccAddressFromBech32(accAddr)
if err != nil {
return nil, err
}
valAddress := sdk.ValAddress(accAddressBech32)
valAddressBech32, err := sdk.ValAddressFromBech32(valAddress.String())
if err != nil {
return nil, err
}
return valAddressBech32, nil
}
func GetAccAddressFromOperatorAddress(valAddress string) (sdk.AccAddress, error) {
valAddressBech32, err := sdk.ValAddressFromBech32(valAddress)
if err != nil {
return nil, err
}
accAddress := sdk.AccAddress(valAddressBech32)
accAddressBech32, err := sdk.AccAddressFromBech32(accAddress.String())
if err != nil {
return nil, err
}
return accAddressBech32, nil
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/query.proto
package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type QueryProveRequest struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
Proof *common.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"`
BlockHash string `protobuf:"bytes,4,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
TxIndex int64 `protobuf:"varint,5,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
}
func (m *QueryProveRequest) Reset() { *m = QueryProveRequest{} }
func (m *QueryProveRequest) String() string { return proto.CompactTextString(m) }
func (*QueryProveRequest) ProtoMessage() {}
func (*QueryProveRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{0}
}
func (m *QueryProveRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryProveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryProveRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryProveRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryProveRequest.Merge(m, src)
}
func (m *QueryProveRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryProveRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryProveRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryProveRequest proto.InternalMessageInfo
func (m *QueryProveRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *QueryProveRequest) GetTxHash() string {
if m != nil {
return m.TxHash
}
return ""
}
func (m *QueryProveRequest) GetProof() *common.Proof {
if m != nil {
return m.Proof
}
return nil
}
func (m *QueryProveRequest) GetBlockHash() string {
if m != nil {
return m.BlockHash
}
return ""
}
func (m *QueryProveRequest) GetTxIndex() int64 {
if m != nil {
return m.TxIndex
}
return 0
}
type QueryProveResponse struct {
Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
}
func (m *QueryProveResponse) Reset() { *m = QueryProveResponse{} }
func (m *QueryProveResponse) String() string { return proto.CompactTextString(m) }
func (*QueryProveResponse) ProtoMessage() {}
func (*QueryProveResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{1}
}
func (m *QueryProveResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryProveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryProveResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryProveResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryProveResponse.Merge(m, src)
}
func (m *QueryProveResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryProveResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryProveResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryProveResponse proto.InternalMessageInfo
func (m *QueryProveResponse) GetValid() bool {
if m != nil {
return m.Valid
}
return false
}
type QueryParamsRequest struct {
}
func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{2}
}
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsRequest.Merge(m, src)
}
func (m *QueryParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo
// QueryParamsResponse is response type for the Query/Params RPC method.
type QueryParamsResponse struct {
// params holds all the parameters of this module.
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{3}
}
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsResponse.Merge(m, src)
}
func (m *QueryParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo
func (m *QueryParamsResponse) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
type QueryBallotByIdentifierRequest struct {
BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"`
}
func (m *QueryBallotByIdentifierRequest) Reset() { *m = QueryBallotByIdentifierRequest{} }
func (m *QueryBallotByIdentifierRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBallotByIdentifierRequest) ProtoMessage() {}
func (*QueryBallotByIdentifierRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{4}
}
func (m *QueryBallotByIdentifierRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryBallotByIdentifierRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryBallotByIdentifierRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryBallotByIdentifierRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryBallotByIdentifierRequest.Merge(m, src)
}
func (m *QueryBallotByIdentifierRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryBallotByIdentifierRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryBallotByIdentifierRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryBallotByIdentifierRequest proto.InternalMessageInfo
func (m *QueryBallotByIdentifierRequest) GetBallotIdentifier() string {
if m != nil {
return m.BallotIdentifier
}
return ""
}
type VoterList struct {
VoterAddress string `protobuf:"bytes,1,opt,name=voter_address,json=voterAddress,proto3" json:"voter_address,omitempty"`
VoteType VoteType `protobuf:"varint,2,opt,name=vote_type,json=voteType,proto3,enum=zetachain.zetacore.observer.VoteType" json:"vote_type,omitempty"`
}
func (m *VoterList) Reset() { *m = VoterList{} }
func (m *VoterList) String() string { return proto.CompactTextString(m) }
func (*VoterList) ProtoMessage() {}
func (*VoterList) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{5}
}
func (m *VoterList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *VoterList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_VoterList.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *VoterList) XXX_Merge(src proto.Message) {
xxx_messageInfo_VoterList.Merge(m, src)
}
func (m *VoterList) XXX_Size() int {
return m.Size()
}
func (m *VoterList) XXX_DiscardUnknown() {
xxx_messageInfo_VoterList.DiscardUnknown(m)
}
var xxx_messageInfo_VoterList proto.InternalMessageInfo
func (m *VoterList) GetVoterAddress() string {
if m != nil {
return m.VoterAddress
}
return ""
}
func (m *VoterList) GetVoteType() VoteType {
if m != nil {
return m.VoteType
}
return VoteType_SuccessObservation
}
type QueryBallotByIdentifierResponse struct {
BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"`
Voters []*VoterList `protobuf:"bytes,2,rep,name=voters,proto3" json:"voters,omitempty"`
ObservationType ObservationType `protobuf:"varint,3,opt,name=observation_type,json=observationType,proto3,enum=zetachain.zetacore.observer.ObservationType" json:"observation_type,omitempty"`
BallotStatus BallotStatus `protobuf:"varint,4,opt,name=ballot_status,json=ballotStatus,proto3,enum=zetachain.zetacore.observer.BallotStatus" json:"ballot_status,omitempty"`
}
func (m *QueryBallotByIdentifierResponse) Reset() { *m = QueryBallotByIdentifierResponse{} }
func (m *QueryBallotByIdentifierResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBallotByIdentifierResponse) ProtoMessage() {}
func (*QueryBallotByIdentifierResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{6}
}
func (m *QueryBallotByIdentifierResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryBallotByIdentifierResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryBallotByIdentifierResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryBallotByIdentifierResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryBallotByIdentifierResponse.Merge(m, src)
}
func (m *QueryBallotByIdentifierResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryBallotByIdentifierResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryBallotByIdentifierResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryBallotByIdentifierResponse proto.InternalMessageInfo
func (m *QueryBallotByIdentifierResponse) GetBallotIdentifier() string {
if m != nil {
return m.BallotIdentifier
}
return ""
}
func (m *QueryBallotByIdentifierResponse) GetVoters() []*VoterList {
if m != nil {
return m.Voters
}
return nil
}
func (m *QueryBallotByIdentifierResponse) GetObservationType() ObservationType {
if m != nil {
return m.ObservationType
}
return ObservationType_EmptyObserverType
}
func (m *QueryBallotByIdentifierResponse) GetBallotStatus() BallotStatus {
if m != nil {
return m.BallotStatus
}
return BallotStatus_BallotFinalized_SuccessObservation
}
type QueryObserversByChainRequest struct {
ObservationChain string `protobuf:"bytes,1,opt,name=observation_chain,json=observationChain,proto3" json:"observation_chain,omitempty"`
}
func (m *QueryObserversByChainRequest) Reset() { *m = QueryObserversByChainRequest{} }
func (m *QueryObserversByChainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryObserversByChainRequest) ProtoMessage() {}
func (*QueryObserversByChainRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{7}
}
func (m *QueryObserversByChainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryObserversByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryObserversByChainRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryObserversByChainRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryObserversByChainRequest.Merge(m, src)
}
func (m *QueryObserversByChainRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryObserversByChainRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryObserversByChainRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryObserversByChainRequest proto.InternalMessageInfo
func (m *QueryObserversByChainRequest) GetObservationChain() string {
if m != nil {
return m.ObservationChain
}
return ""
}
type QueryObserversByChainResponse struct {
Observers []string `protobuf:"bytes,1,rep,name=observers,proto3" json:"observers,omitempty"`
}
func (m *QueryObserversByChainResponse) Reset() { *m = QueryObserversByChainResponse{} }
func (m *QueryObserversByChainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryObserversByChainResponse) ProtoMessage() {}
func (*QueryObserversByChainResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{8}
}
func (m *QueryObserversByChainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryObserversByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryObserversByChainResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryObserversByChainResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryObserversByChainResponse.Merge(m, src)
}
func (m *QueryObserversByChainResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryObserversByChainResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryObserversByChainResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryObserversByChainResponse proto.InternalMessageInfo
func (m *QueryObserversByChainResponse) GetObservers() []string {
if m != nil {
return m.Observers
}
return nil
}
type QueryAllObserverMappersRequest struct {
}
func (m *QueryAllObserverMappersRequest) Reset() { *m = QueryAllObserverMappersRequest{} }
func (m *QueryAllObserverMappersRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllObserverMappersRequest) ProtoMessage() {}
func (*QueryAllObserverMappersRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{9}
}
func (m *QueryAllObserverMappersRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllObserverMappersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllObserverMappersRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllObserverMappersRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllObserverMappersRequest.Merge(m, src)
}
func (m *QueryAllObserverMappersRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllObserverMappersRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllObserverMappersRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllObserverMappersRequest proto.InternalMessageInfo
type QueryAllObserverMappersResponse struct {
ObserverMappers []*ObserverMapper `protobuf:"bytes,1,rep,name=observer_mappers,json=observerMappers,proto3" json:"observer_mappers,omitempty"`
}
func (m *QueryAllObserverMappersResponse) Reset() { *m = QueryAllObserverMappersResponse{} }
func (m *QueryAllObserverMappersResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllObserverMappersResponse) ProtoMessage() {}
func (*QueryAllObserverMappersResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{10}
}
func (m *QueryAllObserverMappersResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllObserverMappersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllObserverMappersResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllObserverMappersResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllObserverMappersResponse.Merge(m, src)
}
func (m *QueryAllObserverMappersResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllObserverMappersResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllObserverMappersResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllObserverMappersResponse proto.InternalMessageInfo
func (m *QueryAllObserverMappersResponse) GetObserverMappers() []*ObserverMapper {
if m != nil {
return m.ObserverMappers
}
return nil
}
type QuerySupportedChains struct {
}
func (m *QuerySupportedChains) Reset() { *m = QuerySupportedChains{} }
func (m *QuerySupportedChains) String() string { return proto.CompactTextString(m) }
func (*QuerySupportedChains) ProtoMessage() {}
func (*QuerySupportedChains) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{11}
}
func (m *QuerySupportedChains) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QuerySupportedChains) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QuerySupportedChains.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QuerySupportedChains) XXX_Merge(src proto.Message) {
xxx_messageInfo_QuerySupportedChains.Merge(m, src)
}
func (m *QuerySupportedChains) XXX_Size() int {
return m.Size()
}
func (m *QuerySupportedChains) XXX_DiscardUnknown() {
xxx_messageInfo_QuerySupportedChains.DiscardUnknown(m)
}
var xxx_messageInfo_QuerySupportedChains proto.InternalMessageInfo
type QuerySupportedChainsResponse struct {
Chains []*common.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"`
}
func (m *QuerySupportedChainsResponse) Reset() { *m = QuerySupportedChainsResponse{} }
func (m *QuerySupportedChainsResponse) String() string { return proto.CompactTextString(m) }
func (*QuerySupportedChainsResponse) ProtoMessage() {}
func (*QuerySupportedChainsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{12}
}
func (m *QuerySupportedChainsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QuerySupportedChainsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QuerySupportedChainsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QuerySupportedChainsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QuerySupportedChainsResponse.Merge(m, src)
}
func (m *QuerySupportedChainsResponse) XXX_Size() int {
return m.Size()
}
func (m *QuerySupportedChainsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QuerySupportedChainsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QuerySupportedChainsResponse proto.InternalMessageInfo
func (m *QuerySupportedChainsResponse) GetChains() []*common.Chain {
if m != nil {
return m.Chains
}
return nil
}
type QueryGetCoreParamsForChainRequest struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *QueryGetCoreParamsForChainRequest) Reset() { *m = QueryGetCoreParamsForChainRequest{} }
func (m *QueryGetCoreParamsForChainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsForChainRequest) ProtoMessage() {}
func (*QueryGetCoreParamsForChainRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{13}
}
func (m *QueryGetCoreParamsForChainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCoreParamsForChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCoreParamsForChainRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCoreParamsForChainRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCoreParamsForChainRequest.Merge(m, src)
}
func (m *QueryGetCoreParamsForChainRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCoreParamsForChainRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCoreParamsForChainRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCoreParamsForChainRequest proto.InternalMessageInfo
func (m *QueryGetCoreParamsForChainRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
type QueryGetCoreParamsForChainResponse struct {
CoreParams *CoreParams `protobuf:"bytes,1,opt,name=core_params,json=coreParams,proto3" json:"core_params,omitempty"`
}
func (m *QueryGetCoreParamsForChainResponse) Reset() { *m = QueryGetCoreParamsForChainResponse{} }
func (m *QueryGetCoreParamsForChainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsForChainResponse) ProtoMessage() {}
func (*QueryGetCoreParamsForChainResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{14}
}
func (m *QueryGetCoreParamsForChainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCoreParamsForChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCoreParamsForChainResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCoreParamsForChainResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCoreParamsForChainResponse.Merge(m, src)
}
func (m *QueryGetCoreParamsForChainResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCoreParamsForChainResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCoreParamsForChainResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCoreParamsForChainResponse proto.InternalMessageInfo
func (m *QueryGetCoreParamsForChainResponse) GetCoreParams() *CoreParams {
if m != nil {
return m.CoreParams
}
return nil
}
type QueryGetCoreParamsRequest struct {
}
func (m *QueryGetCoreParamsRequest) Reset() { *m = QueryGetCoreParamsRequest{} }
func (m *QueryGetCoreParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsRequest) ProtoMessage() {}
func (*QueryGetCoreParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{15}
}
func (m *QueryGetCoreParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCoreParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCoreParamsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCoreParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCoreParamsRequest.Merge(m, src)
}
func (m *QueryGetCoreParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCoreParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCoreParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCoreParamsRequest proto.InternalMessageInfo
type QueryGetCoreParamsResponse struct {
CoreParams *CoreParamsList `protobuf:"bytes,1,opt,name=core_params,json=coreParams,proto3" json:"core_params,omitempty"`
}
func (m *QueryGetCoreParamsResponse) Reset() { *m = QueryGetCoreParamsResponse{} }
func (m *QueryGetCoreParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsResponse) ProtoMessage() {}
func (*QueryGetCoreParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{16}
}
func (m *QueryGetCoreParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCoreParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCoreParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCoreParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCoreParamsResponse.Merge(m, src)
}
func (m *QueryGetCoreParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCoreParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCoreParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCoreParamsResponse proto.InternalMessageInfo
func (m *QueryGetCoreParamsResponse) GetCoreParams() *CoreParamsList {
if m != nil {
return m.CoreParams
}
return nil
}
type QueryGetNodeAccountRequest struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *QueryGetNodeAccountRequest) Reset() { *m = QueryGetNodeAccountRequest{} }
func (m *QueryGetNodeAccountRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetNodeAccountRequest) ProtoMessage() {}
func (*QueryGetNodeAccountRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{17}
}
func (m *QueryGetNodeAccountRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetNodeAccountRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetNodeAccountRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetNodeAccountRequest.Merge(m, src)
}
func (m *QueryGetNodeAccountRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetNodeAccountRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetNodeAccountRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetNodeAccountRequest proto.InternalMessageInfo
func (m *QueryGetNodeAccountRequest) GetIndex() string {
if m != nil {
return m.Index
}
return ""
}
type QueryGetNodeAccountResponse struct {
NodeAccount *NodeAccount `protobuf:"bytes,1,opt,name=node_account,json=nodeAccount,proto3" json:"node_account,omitempty"`
}
func (m *QueryGetNodeAccountResponse) Reset() { *m = QueryGetNodeAccountResponse{} }
func (m *QueryGetNodeAccountResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetNodeAccountResponse) ProtoMessage() {}
func (*QueryGetNodeAccountResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{18}
}
func (m *QueryGetNodeAccountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetNodeAccountResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetNodeAccountResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetNodeAccountResponse.Merge(m, src)
}
func (m *QueryGetNodeAccountResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetNodeAccountResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetNodeAccountResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetNodeAccountResponse proto.InternalMessageInfo
func (m *QueryGetNodeAccountResponse) GetNodeAccount() *NodeAccount {
if m != nil {
return m.NodeAccount
}
return nil
}
type QueryAllNodeAccountRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllNodeAccountRequest) Reset() { *m = QueryAllNodeAccountRequest{} }
func (m *QueryAllNodeAccountRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllNodeAccountRequest) ProtoMessage() {}
func (*QueryAllNodeAccountRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{19}
}
func (m *QueryAllNodeAccountRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllNodeAccountRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllNodeAccountRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllNodeAccountRequest.Merge(m, src)
}
func (m *QueryAllNodeAccountRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllNodeAccountRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllNodeAccountRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllNodeAccountRequest proto.InternalMessageInfo
func (m *QueryAllNodeAccountRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllNodeAccountResponse struct {
NodeAccount []*NodeAccount `protobuf:"bytes,1,rep,name=NodeAccount,proto3" json:"NodeAccount,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllNodeAccountResponse) Reset() { *m = QueryAllNodeAccountResponse{} }
func (m *QueryAllNodeAccountResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllNodeAccountResponse) ProtoMessage() {}
func (*QueryAllNodeAccountResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{20}
}
func (m *QueryAllNodeAccountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllNodeAccountResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllNodeAccountResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllNodeAccountResponse.Merge(m, src)
}
func (m *QueryAllNodeAccountResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllNodeAccountResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllNodeAccountResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllNodeAccountResponse proto.InternalMessageInfo
func (m *QueryAllNodeAccountResponse) GetNodeAccount() []*NodeAccount {
if m != nil {
return m.NodeAccount
}
return nil
}
func (m *QueryAllNodeAccountResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryGetCrosschainFlagsRequest struct {
}
func (m *QueryGetCrosschainFlagsRequest) Reset() { *m = QueryGetCrosschainFlagsRequest{} }
func (m *QueryGetCrosschainFlagsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCrosschainFlagsRequest) ProtoMessage() {}
func (*QueryGetCrosschainFlagsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{21}
}
func (m *QueryGetCrosschainFlagsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCrosschainFlagsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCrosschainFlagsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCrosschainFlagsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCrosschainFlagsRequest.Merge(m, src)
}
func (m *QueryGetCrosschainFlagsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCrosschainFlagsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCrosschainFlagsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCrosschainFlagsRequest proto.InternalMessageInfo
type QueryGetCrosschainFlagsResponse struct {
CrosschainFlags CrosschainFlags `protobuf:"bytes,1,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags"`
}
func (m *QueryGetCrosschainFlagsResponse) Reset() { *m = QueryGetCrosschainFlagsResponse{} }
func (m *QueryGetCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetCrosschainFlagsResponse) ProtoMessage() {}
func (*QueryGetCrosschainFlagsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{22}
}
func (m *QueryGetCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetCrosschainFlagsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetCrosschainFlagsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetCrosschainFlagsResponse.Merge(m, src)
}
func (m *QueryGetCrosschainFlagsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetCrosschainFlagsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetCrosschainFlagsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetCrosschainFlagsResponse proto.InternalMessageInfo
func (m *QueryGetCrosschainFlagsResponse) GetCrosschainFlags() CrosschainFlags {
if m != nil {
return m.CrosschainFlags
}
return CrosschainFlags{}
}
type QueryGetKeygenRequest struct {
}
func (m *QueryGetKeygenRequest) Reset() { *m = QueryGetKeygenRequest{} }
func (m *QueryGetKeygenRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetKeygenRequest) ProtoMessage() {}
func (*QueryGetKeygenRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{23}
}
func (m *QueryGetKeygenRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetKeygenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetKeygenRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetKeygenRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetKeygenRequest.Merge(m, src)
}
func (m *QueryGetKeygenRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetKeygenRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetKeygenRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetKeygenRequest proto.InternalMessageInfo
type QueryGetKeygenResponse struct {
Keygen *Keygen `protobuf:"bytes,1,opt,name=keygen,proto3" json:"keygen,omitempty"`
}
func (m *QueryGetKeygenResponse) Reset() { *m = QueryGetKeygenResponse{} }
func (m *QueryGetKeygenResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetKeygenResponse) ProtoMessage() {}
func (*QueryGetKeygenResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{24}
}
func (m *QueryGetKeygenResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetKeygenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetKeygenResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetKeygenResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetKeygenResponse.Merge(m, src)
}
func (m *QueryGetKeygenResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetKeygenResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetKeygenResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetKeygenResponse proto.InternalMessageInfo
func (m *QueryGetKeygenResponse) GetKeygen() *Keygen {
if m != nil {
return m.Keygen
}
return nil
}
type QueryShowObserverCountRequest struct {
}
func (m *QueryShowObserverCountRequest) Reset() { *m = QueryShowObserverCountRequest{} }
func (m *QueryShowObserverCountRequest) String() string { return proto.CompactTextString(m) }
func (*QueryShowObserverCountRequest) ProtoMessage() {}
func (*QueryShowObserverCountRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{25}
}
func (m *QueryShowObserverCountRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryShowObserverCountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryShowObserverCountRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryShowObserverCountRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryShowObserverCountRequest.Merge(m, src)
}
func (m *QueryShowObserverCountRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryShowObserverCountRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryShowObserverCountRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryShowObserverCountRequest proto.InternalMessageInfo
type QueryShowObserverCountResponse struct {
LastObserverCount *LastObserverCount `protobuf:"bytes,1,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"`
}
func (m *QueryShowObserverCountResponse) Reset() { *m = QueryShowObserverCountResponse{} }
func (m *QueryShowObserverCountResponse) String() string { return proto.CompactTextString(m) }
func (*QueryShowObserverCountResponse) ProtoMessage() {}
func (*QueryShowObserverCountResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{26}
}
func (m *QueryShowObserverCountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryShowObserverCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryShowObserverCountResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryShowObserverCountResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryShowObserverCountResponse.Merge(m, src)
}
func (m *QueryShowObserverCountResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryShowObserverCountResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryShowObserverCountResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryShowObserverCountResponse proto.InternalMessageInfo
func (m *QueryShowObserverCountResponse) GetLastObserverCount() *LastObserverCount {
if m != nil {
return m.LastObserverCount
}
return nil
}
type QueryBlameByIdentifierRequest struct {
BlameIdentifier string `protobuf:"bytes,1,opt,name=blame_identifier,json=blameIdentifier,proto3" json:"blame_identifier,omitempty"`
}
func (m *QueryBlameByIdentifierRequest) Reset() { *m = QueryBlameByIdentifierRequest{} }
func (m *QueryBlameByIdentifierRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBlameByIdentifierRequest) ProtoMessage() {}
func (*QueryBlameByIdentifierRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{27}
}
func (m *QueryBlameByIdentifierRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryBlameByIdentifierRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryBlameByIdentifierRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryBlameByIdentifierRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryBlameByIdentifierRequest.Merge(m, src)
}
func (m *QueryBlameByIdentifierRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryBlameByIdentifierRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryBlameByIdentifierRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryBlameByIdentifierRequest proto.InternalMessageInfo
func (m *QueryBlameByIdentifierRequest) GetBlameIdentifier() string {
if m != nil {
return m.BlameIdentifier
}
return ""
}
type QueryBlameByIdentifierResponse struct {
BlameInfo *Blame `protobuf:"bytes,1,opt,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"`
}
func (m *QueryBlameByIdentifierResponse) Reset() { *m = QueryBlameByIdentifierResponse{} }
func (m *QueryBlameByIdentifierResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBlameByIdentifierResponse) ProtoMessage() {}
func (*QueryBlameByIdentifierResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{28}
}
func (m *QueryBlameByIdentifierResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryBlameByIdentifierResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryBlameByIdentifierResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryBlameByIdentifierResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryBlameByIdentifierResponse.Merge(m, src)
}
func (m *QueryBlameByIdentifierResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryBlameByIdentifierResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryBlameByIdentifierResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryBlameByIdentifierResponse proto.InternalMessageInfo
func (m *QueryBlameByIdentifierResponse) GetBlameInfo() *Blame {
if m != nil {
return m.BlameInfo
}
return nil
}
type QueryAllBlameRecordsRequest struct {
}
func (m *QueryAllBlameRecordsRequest) Reset() { *m = QueryAllBlameRecordsRequest{} }
func (m *QueryAllBlameRecordsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllBlameRecordsRequest) ProtoMessage() {}
func (*QueryAllBlameRecordsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{29}
}
func (m *QueryAllBlameRecordsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllBlameRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllBlameRecordsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllBlameRecordsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllBlameRecordsRequest.Merge(m, src)
}
func (m *QueryAllBlameRecordsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllBlameRecordsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllBlameRecordsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllBlameRecordsRequest proto.InternalMessageInfo
type QueryAllBlameRecordsResponse struct {
BlameInfo []*Blame `protobuf:"bytes,1,rep,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"`
}
func (m *QueryAllBlameRecordsResponse) Reset() { *m = QueryAllBlameRecordsResponse{} }
func (m *QueryAllBlameRecordsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllBlameRecordsResponse) ProtoMessage() {}
func (*QueryAllBlameRecordsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{30}
}
func (m *QueryAllBlameRecordsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllBlameRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllBlameRecordsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllBlameRecordsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllBlameRecordsResponse.Merge(m, src)
}
func (m *QueryAllBlameRecordsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllBlameRecordsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllBlameRecordsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllBlameRecordsResponse proto.InternalMessageInfo
func (m *QueryAllBlameRecordsResponse) GetBlameInfo() []*Blame {
if m != nil {
return m.BlameInfo
}
return nil
}
type QueryBlameByChainAndNonceRequest struct {
ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Nonce int64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
}
func (m *QueryBlameByChainAndNonceRequest) Reset() { *m = QueryBlameByChainAndNonceRequest{} }
func (m *QueryBlameByChainAndNonceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBlameByChainAndNonceRequest) ProtoMessage() {}
func (*QueryBlameByChainAndNonceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{31}
}
func (m *QueryBlameByChainAndNonceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryBlameByChainAndNonceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryBlameByChainAndNonceRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryBlameByChainAndNonceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryBlameByChainAndNonceRequest.Merge(m, src)
}
func (m *QueryBlameByChainAndNonceRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryBlameByChainAndNonceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryBlameByChainAndNonceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryBlameByChainAndNonceRequest proto.InternalMessageInfo
func (m *QueryBlameByChainAndNonceRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *QueryBlameByChainAndNonceRequest) GetNonce() int64 {
if m != nil {
return m.Nonce
}
return 0
}
type QueryBlameByChainAndNonceResponse struct {
BlameInfo []*Blame `protobuf:"bytes,1,rep,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"`
}
func (m *QueryBlameByChainAndNonceResponse) Reset() { *m = QueryBlameByChainAndNonceResponse{} }
func (m *QueryBlameByChainAndNonceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBlameByChainAndNonceResponse) ProtoMessage() {}
func (*QueryBlameByChainAndNonceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{32}
}
func (m *QueryBlameByChainAndNonceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryBlameByChainAndNonceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryBlameByChainAndNonceResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryBlameByChainAndNonceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryBlameByChainAndNonceResponse.Merge(m, src)
}
func (m *QueryBlameByChainAndNonceResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryBlameByChainAndNonceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryBlameByChainAndNonceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryBlameByChainAndNonceResponse proto.InternalMessageInfo
func (m *QueryBlameByChainAndNonceResponse) GetBlameInfo() []*Blame {
if m != nil {
return m.BlameInfo
}
return nil
}
type QueryAllBlockHeaderRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllBlockHeaderRequest) Reset() { *m = QueryAllBlockHeaderRequest{} }
func (m *QueryAllBlockHeaderRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllBlockHeaderRequest) ProtoMessage() {}
func (*QueryAllBlockHeaderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{33}
}
func (m *QueryAllBlockHeaderRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllBlockHeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllBlockHeaderRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllBlockHeaderRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllBlockHeaderRequest.Merge(m, src)
}
func (m *QueryAllBlockHeaderRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryAllBlockHeaderRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllBlockHeaderRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllBlockHeaderRequest proto.InternalMessageInfo
func (m *QueryAllBlockHeaderRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryAllBlockHeaderResponse struct {
BlockHeaders []*common.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryAllBlockHeaderResponse) Reset() { *m = QueryAllBlockHeaderResponse{} }
func (m *QueryAllBlockHeaderResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllBlockHeaderResponse) ProtoMessage() {}
func (*QueryAllBlockHeaderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{34}
}
func (m *QueryAllBlockHeaderResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryAllBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryAllBlockHeaderResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryAllBlockHeaderResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryAllBlockHeaderResponse.Merge(m, src)
}
func (m *QueryAllBlockHeaderResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryAllBlockHeaderResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryAllBlockHeaderResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryAllBlockHeaderResponse proto.InternalMessageInfo
func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*common.BlockHeader {
if m != nil {
return m.BlockHeaders
}
return nil
}
func (m *QueryAllBlockHeaderResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
type QueryGetBlockHeaderByHashRequest struct {
BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
}
func (m *QueryGetBlockHeaderByHashRequest) Reset() { *m = QueryGetBlockHeaderByHashRequest{} }
func (m *QueryGetBlockHeaderByHashRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetBlockHeaderByHashRequest) ProtoMessage() {}
func (*QueryGetBlockHeaderByHashRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{35}
}
func (m *QueryGetBlockHeaderByHashRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetBlockHeaderByHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetBlockHeaderByHashRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Merge(m, src)
}
func (m *QueryGetBlockHeaderByHashRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetBlockHeaderByHashRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetBlockHeaderByHashRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetBlockHeaderByHashRequest proto.InternalMessageInfo
func (m *QueryGetBlockHeaderByHashRequest) GetBlockHash() []byte {
if m != nil {
return m.BlockHash
}
return nil
}
type QueryGetBlockHeaderByHashResponse struct {
BlockHeader *common.BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"`
}
func (m *QueryGetBlockHeaderByHashResponse) Reset() { *m = QueryGetBlockHeaderByHashResponse{} }
func (m *QueryGetBlockHeaderByHashResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetBlockHeaderByHashResponse) ProtoMessage() {}
func (*QueryGetBlockHeaderByHashResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dcb801e455adaee4, []int{36}
}
func (m *QueryGetBlockHeaderByHashResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetBlockHeaderByHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryGetBlockHeaderByHashResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Merge(m, src)
}
func (m *QueryGetBlockHeaderByHashResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetBlockHeaderByHashResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetBlockHeaderByHashResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetBlockHeaderByHashResponse proto.InternalMessageInfo
func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *common.BlockHeader {
if m != nil {
return m.BlockHeader
}
return nil
}
func init() {
proto.RegisterType((*QueryProveRequest)(nil), "zetachain.zetacore.observer.QueryProveRequest")
proto.RegisterType((*QueryProveResponse)(nil), "zetachain.zetacore.observer.QueryProveResponse")
proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.observer.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.observer.QueryParamsResponse")
proto.RegisterType((*QueryBallotByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierRequest")
proto.RegisterType((*VoterList)(nil), "zetachain.zetacore.observer.VoterList")
proto.RegisterType((*QueryBallotByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierResponse")
proto.RegisterType((*QueryObserversByChainRequest)(nil), "zetachain.zetacore.observer.QueryObserversByChainRequest")
proto.RegisterType((*QueryObserversByChainResponse)(nil), "zetachain.zetacore.observer.QueryObserversByChainResponse")
proto.RegisterType((*QueryAllObserverMappersRequest)(nil), "zetachain.zetacore.observer.QueryAllObserverMappersRequest")
proto.RegisterType((*QueryAllObserverMappersResponse)(nil), "zetachain.zetacore.observer.QueryAllObserverMappersResponse")
proto.RegisterType((*QuerySupportedChains)(nil), "zetachain.zetacore.observer.QuerySupportedChains")
proto.RegisterType((*QuerySupportedChainsResponse)(nil), "zetachain.zetacore.observer.QuerySupportedChainsResponse")
proto.RegisterType((*QueryGetCoreParamsForChainRequest)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsForChainRequest")
proto.RegisterType((*QueryGetCoreParamsForChainResponse)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsForChainResponse")
proto.RegisterType((*QueryGetCoreParamsRequest)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsRequest")
proto.RegisterType((*QueryGetCoreParamsResponse)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsResponse")
proto.RegisterType((*QueryGetNodeAccountRequest)(nil), "zetachain.zetacore.observer.QueryGetNodeAccountRequest")
proto.RegisterType((*QueryGetNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryGetNodeAccountResponse")
proto.RegisterType((*QueryAllNodeAccountRequest)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountRequest")
proto.RegisterType((*QueryAllNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountResponse")
proto.RegisterType((*QueryGetCrosschainFlagsRequest)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsRequest")
proto.RegisterType((*QueryGetCrosschainFlagsResponse)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsResponse")
proto.RegisterType((*QueryGetKeygenRequest)(nil), "zetachain.zetacore.observer.QueryGetKeygenRequest")
proto.RegisterType((*QueryGetKeygenResponse)(nil), "zetachain.zetacore.observer.QueryGetKeygenResponse")
proto.RegisterType((*QueryShowObserverCountRequest)(nil), "zetachain.zetacore.observer.QueryShowObserverCountRequest")
proto.RegisterType((*QueryShowObserverCountResponse)(nil), "zetachain.zetacore.observer.QueryShowObserverCountResponse")
proto.RegisterType((*QueryBlameByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierRequest")
proto.RegisterType((*QueryBlameByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierResponse")
proto.RegisterType((*QueryAllBlameRecordsRequest)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsRequest")
proto.RegisterType((*QueryAllBlameRecordsResponse)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsResponse")
proto.RegisterType((*QueryBlameByChainAndNonceRequest)(nil), "zetachain.zetacore.observer.QueryBlameByChainAndNonceRequest")
proto.RegisterType((*QueryBlameByChainAndNonceResponse)(nil), "zetachain.zetacore.observer.QueryBlameByChainAndNonceResponse")
proto.RegisterType((*QueryAllBlockHeaderRequest)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderRequest")
proto.RegisterType((*QueryAllBlockHeaderResponse)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderResponse")
proto.RegisterType((*QueryGetBlockHeaderByHashRequest)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashRequest")
proto.RegisterType((*QueryGetBlockHeaderByHashResponse)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashResponse")
}
func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) }
var fileDescriptor_dcb801e455adaee4 = []byte{
// 1881 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcf, 0x6f, 0x1b, 0xc7,
0x15, 0xd6, 0x4a, 0x11, 0x23, 0x3d, 0x4a, 0x96, 0x34, 0xa2, 0x62, 0x79, 0x25, 0x51, 0xea, 0xa8,
0x76, 0x64, 0xc9, 0xe1, 0x46, 0x34, 0x90, 0xd8, 0x51, 0xa4, 0x94, 0x14, 0x62, 0x59, 0xb1, 0xe3,
0xb8, 0x54, 0x9b, 0x16, 0x2d, 0x5a, 0x62, 0x49, 0x8e, 0x28, 0x26, 0xab, 0x1d, 0x66, 0x77, 0x25,
0x8b, 0x15, 0x04, 0x14, 0x3d, 0xf7, 0x60, 0xa0, 0x40, 0xcf, 0x3d, 0xf5, 0xd6, 0x1e, 0x7c, 0xe9,
0xa1, 0xe8, 0xa5, 0x97, 0xfa, 0x54, 0xb8, 0x28, 0x50, 0xb4, 0x87, 0x16, 0x86, 0xdd, 0x3f, 0xa0,
0x7f, 0x42, 0x31, 0x3f, 0x76, 0x39, 0x5c, 0xee, 0x92, 0x4b, 0xc1, 0x27, 0x71, 0x67, 0xe6, 0xbd,
0xf9, 0xbe, 0x37, 0x33, 0xef, 0xbd, 0x0f, 0x82, 0x0c, 0xad, 0xb8, 0xc4, 0x39, 0x25, 0x8e, 0xf1,
0xcd, 0x09, 0x71, 0x5a, 0xb9, 0xa6, 0x43, 0x3d, 0x8a, 0x16, 0x7e, 0x46, 0x3c, 0xb3, 0x7a, 0x64,
0x36, 0xec, 0x1c, 0xff, 0x45, 0x1d, 0x92, 0xf3, 0x17, 0xea, 0xb3, 0x55, 0x7a, 0x7c, 0x4c, 0x6d,
0x43, 0xfc, 0x11, 0x16, 0xfa, 0x7a, 0x95, 0xba, 0xc7, 0xd4, 0x35, 0x2a, 0xa6, 0x4b, 0x84, 0x2b,
0xe3, 0x74, 0xb3, 0x42, 0x3c, 0x73, 0xd3, 0x68, 0x9a, 0xf5, 0x86, 0x6d, 0x7a, 0x8d, 0x60, 0x6d,
0xa6, 0x4e, 0xeb, 0x94, 0xff, 0x34, 0xd8, 0x2f, 0x39, 0xba, 0x58, 0xa7, 0xb4, 0x6e, 0x11, 0xc3,
0x6c, 0x36, 0x0c, 0xd3, 0xb6, 0xa9, 0xc7, 0x4d, 0x5c, 0x39, 0x3b, 0x17, 0xe0, 0xac, 0x98, 0x96,
0x45, 0x3d, 0xdf, 0x55, 0x7b, 0xd8, 0x32, 0x8f, 0x89, 0x1c, 0x5d, 0x0e, 0x46, 0xab, 0x0e, 0x75,
0x5d, 0x4e, 0xa4, 0x7c, 0x68, 0x99, 0xf5, 0x6e, 0x6f, 0x5f, 0x93, 0x56, 0x9d, 0xf8, 0xc0, 0x16,
0x82, 0x61, 0x9b, 0xd6, 0x48, 0xd9, 0xac, 0x56, 0xe9, 0x89, 0xed, 0x6f, 0x75, 0x35, 0x98, 0xf4,
0x7f, 0x74, 0x39, 0x6b, 0x9a, 0x8e, 0x79, 0x2c, 0xf7, 0xc0, 0xbf, 0xd5, 0x60, 0xe6, 0xbb, 0x2c,
0x10, 0x8f, 0x1d, 0x7a, 0x4a, 0x4a, 0xe4, 0x9b, 0x13, 0xe2, 0x7a, 0xe8, 0x1a, 0x8c, 0x09, 0x38,
0x8d, 0xda, 0xbc, 0xb6, 0xa2, 0xad, 0x8d, 0x94, 0xde, 0xe6, 0xdf, 0xfb, 0x35, 0x74, 0x15, 0xde,
0xf6, 0xce, 0xca, 0x47, 0xa6, 0x7b, 0x34, 0x3f, 0xbc, 0xa2, 0xad, 0x8d, 0x97, 0x52, 0xde, 0xd9,
0x7d, 0xd3, 0x3d, 0x42, 0xab, 0x30, 0xda, 0x74, 0x28, 0x3d, 0x9c, 0x1f, 0x59, 0xd1, 0xd6, 0xd2,
0xf9, 0xc9, 0x9c, 0x8c, 0xfc, 0x63, 0x36, 0x58, 0x12, 0x73, 0x68, 0x09, 0xa0, 0x62, 0xd1, 0xea,
0xd7, 0xc2, 0xc1, 0x5b, 0xdc, 0xc1, 0x38, 0x1f, 0xe1, 0x3e, 0xae, 0xc1, 0x98, 0x77, 0x56, 0x6e,
0xd8, 0x35, 0x72, 0x36, 0x3f, 0x2a, 0xf6, 0xf5, 0xce, 0xf6, 0xd9, 0x27, 0x5e, 0x07, 0xa4, 0xe2,
0x74, 0x9b, 0xd4, 0x76, 0x09, 0xca, 0xc0, 0xe8, 0xa9, 0x69, 0x49, 0x94, 0x63, 0x25, 0xf1, 0x81,
0x33, 0xfe, 0x5a, 0xce, 0x54, 0x92, 0xc2, 0x3f, 0x84, 0xd9, 0x8e, 0x51, 0xe9, 0xa2, 0x00, 0x29,
0x11, 0x11, 0xee, 0x23, 0x9d, 0x5f, 0xcd, 0xf5, 0xb8, 0x56, 0x39, 0x61, 0x5c, 0x7c, 0xeb, 0xf9,
0x7f, 0x96, 0x87, 0x4a, 0xd2, 0x10, 0x7f, 0x0e, 0x59, 0xee, 0xb9, 0xc8, 0x0f, 0xbd, 0xd8, 0xda,
0xaf, 0x11, 0xdb, 0x6b, 0x1c, 0x36, 0x88, 0xe3, 0x07, 0x74, 0x03, 0x66, 0xc4, 0x8d, 0x28, 0x37,
0x82, 0x39, 0xbe, 0xdf, 0x78, 0x69, 0x5a, 0x4c, 0xb4, 0x6d, 0xb0, 0x07, 0xe3, 0x5f, 0x52, 0x8f,
0x38, 0x0f, 0x1b, 0xae, 0x87, 0x56, 0x61, 0xf2, 0x94, 0x7d, 0x94, 0xcd, 0x5a, 0xcd, 0x21, 0xae,
0x2b, 0xad, 0x26, 0xf8, 0x60, 0x41, 0x8c, 0xa1, 0x22, 0x8c, 0xb3, 0xef, 0xb2, 0xd7, 0x6a, 0x12,
0x7e, 0x2c, 0x57, 0xf2, 0xd7, 0x7b, 0xd2, 0x60, 0xfe, 0xbf, 0xd7, 0x6a, 0x92, 0xd2, 0xd8, 0xa9,
0xfc, 0x85, 0xff, 0x30, 0x0c, 0xcb, 0xb1, 0x2c, 0x64, 0xac, 0x06, 0xa1, 0x81, 0x76, 0x20, 0xc5,
0x41, 0xba, 0xf3, 0xc3, 0x2b, 0x23, 0x6b, 0xe9, 0xfc, 0x8d, 0xbe, 0x88, 0x38, 0xe3, 0x92, 0xb4,
0x42, 0x3f, 0x80, 0x69, 0x31, 0xcb, 0x9f, 0x98, 0xe0, 0x36, 0xc2, 0xb9, 0xdd, 0xea, 0xe9, 0xe9,
0x8b, 0xb6, 0x11, 0xa7, 0x38, 0x45, 0x3b, 0x07, 0xd0, 0x23, 0x98, 0x94, 0x2c, 0x5c, 0xcf, 0xf4,
0x4e, 0x5c, 0x7e, 0x0f, 0xaf, 0xe4, 0x6f, 0xf6, 0xf4, 0x2a, 0xa2, 0x72, 0xc0, 0x0d, 0x4a, 0x13,
0x15, 0xe5, 0x0b, 0x3f, 0x80, 0x45, 0x1e, 0xb8, 0x2f, 0xe4, 0x5a, 0xb7, 0xd8, 0xda, 0x65, 0x5e,
0x94, 0xc3, 0x57, 0x89, 0xf0, 0x1d, 0xfc, 0xa8, 0x29, 0x13, 0xdc, 0x06, 0x6f, 0xc3, 0x52, 0x8c,
0x33, 0x79, 0x06, 0x8b, 0x30, 0xee, 0x83, 0x62, 0x97, 0x61, 0x84, 0xbd, 0xa0, 0x60, 0x00, 0xaf,
0xc8, 0xab, 0x58, 0xb0, 0x2c, 0xdf, 0xc3, 0xe7, 0x66, 0xb3, 0x49, 0x9c, 0xe0, 0x19, 0xb4, 0xe4,
0x31, 0x47, 0xad, 0x90, 0x5b, 0x7c, 0xe9, 0x47, 0x9e, 0x38, 0xe5, 0x63, 0x31, 0xc7, 0x77, 0x4a,
0xe7, 0x37, 0x12, 0x44, 0xde, 0xf7, 0xe7, 0x07, 0x3e, 0xf0, 0x8f, 0xdf, 0x81, 0x0c, 0xdf, 0xfa,
0xe0, 0xa4, 0xd9, 0xa4, 0x8e, 0x47, 0x6a, 0x9c, 0x99, 0x8b, 0x3f, 0x95, 0x01, 0x0c, 0x8d, 0x07,
0x78, 0xae, 0x43, 0x8a, 0x6f, 0xe9, 0xa3, 0x08, 0x72, 0x8b, 0x88, 0x8c, 0x9c, 0xc4, 0x3b, 0xf0,
0x2d, 0xee, 0x66, 0x8f, 0x78, 0xbb, 0xd4, 0x21, 0xe2, 0xa9, 0xde, 0xa3, 0x4e, 0xc7, 0x61, 0xc4,
0xa7, 0x36, 0x6c, 0x03, 0xee, 0x65, 0x2f, 0xc1, 0xdc, 0x87, 0x34, 0x63, 0x5d, 0xee, 0x48, 0x1a,
0xef, 0xf6, 0x8c, 0x4b, 0xdb, 0x5b, 0x09, 0xaa, 0xc1, 0x6f, 0xbc, 0x00, 0xd7, 0xba, 0xf7, 0xf3,
0x8f, 0xe9, 0x2b, 0xd0, 0xa3, 0x26, 0x25, 0x88, 0x87, 0x51, 0x20, 0x36, 0x12, 0x82, 0xe0, 0xaf,
0x4c, 0x05, 0x92, 0x6f, 0xef, 0xf5, 0x88, 0xd6, 0x48, 0x41, 0x54, 0x14, 0x3f, 0x62, 0x19, 0x18,
0x15, 0x19, 0x59, 0x5c, 0x59, 0xf1, 0x81, 0xbf, 0x82, 0x85, 0x48, 0x1b, 0x09, 0xf0, 0x01, 0x4c,
0xa8, 0xd5, 0x49, 0x22, 0x5c, 0xeb, 0x89, 0x50, 0xf5, 0x93, 0xb6, 0xdb, 0x1f, 0xb8, 0x26, 0xf1,
0x15, 0x2c, 0x2b, 0x02, 0xdf, 0x3d, 0x80, 0x76, 0xf1, 0x96, 0x1b, 0xdd, 0xc8, 0x89, 0x4a, 0x9f,
0x63, 0x95, 0x3e, 0x27, 0x9a, 0x06, 0x59, 0xe9, 0x73, 0x8f, 0xcd, 0xba, 0x5f, 0xe8, 0x4a, 0x8a,
0x25, 0x7e, 0xa6, 0x49, 0x4a, 0xe1, 0x6d, 0x24, 0xa5, 0xcf, 0x20, 0xad, 0x0c, 0xcb, 0xab, 0x38,
0x00, 0x23, 0xe5, 0x03, 0xed, 0x75, 0x60, 0x1e, 0x96, 0x77, 0xa8, 0x1f, 0x66, 0x01, 0xa4, 0x03,
0xb4, 0xff, 0xde, 0xd9, 0x35, 0x09, 0xba, 0x88, 0x7b, 0xac, 0x89, 0xf0, 0x2f, 0xd2, 0xcf, 0x35,
0xf9, 0xe0, 0xa3, 0x96, 0x48, 0x6a, 0x3f, 0x81, 0xe9, 0x70, 0x0f, 0x22, 0x03, 0xd9, 0x3b, 0xd5,
0x86, 0xfc, 0xc9, 0xb2, 0x38, 0x55, 0xed, 0x1c, 0xc6, 0x57, 0x61, 0xce, 0x47, 0xf0, 0x80, 0x77,
0x32, 0x3e, 0xb6, 0xef, 0xc3, 0x3b, 0xe1, 0x09, 0x89, 0x68, 0x0b, 0x52, 0xa2, 0xe9, 0x49, 0x54,
0x95, 0xa5, 0xb1, 0x34, 0xc1, 0xcb, 0x32, 0x87, 0x1e, 0x1c, 0xd1, 0x27, 0x7e, 0x4e, 0xda, 0x55,
0xae, 0x0c, 0x8b, 0x49, 0x36, 0x6e, 0x85, 0x04, 0xf0, 0x53, 0x98, 0xb5, 0x4c, 0xd7, 0x2b, 0x07,
0x89, 0x50, 0xbd, 0xc7, 0xb9, 0x9e, 0x68, 0x1e, 0x9a, 0xae, 0xd7, 0xe9, 0x74, 0xc6, 0x0a, 0x0f,
0xe1, 0xcf, 0x24, 0xc6, 0x22, 0xeb, 0x08, 0xa3, 0x5a, 0x86, 0x9b, 0x30, 0xcd, 0xbb, 0xc5, 0xee,
0x52, 0x3b, 0xc5, 0xc7, 0x95, 0x86, 0xa1, 0xea, 0xf7, 0x1f, 0xdd, 0xbe, 0x82, 0x26, 0x07, 0xa4,
0x33, 0xfb, 0x90, 0x4a, 0x12, 0xb8, 0x77, 0xbd, 0x63, 0xcb, 0x59, 0x6f, 0xc6, 0xb6, 0xb2, 0x0f,
0x29, 0x5e, 0x6a, 0xbf, 0x0e, 0x31, 0x47, 0xaa, 0xd4, 0xa9, 0x05, 0xd7, 0xcc, 0x94, 0x39, 0xbc,
0x6b, 0x3a, 0x06, 0xc1, 0xc8, 0xe0, 0x08, 0x0e, 0x60, 0x45, 0xa5, 0xc9, 0xd3, 0x72, 0xc1, 0xae,
0x3d, 0xa2, 0x76, 0x35, 0x49, 0xe7, 0x9a, 0x81, 0x51, 0x9b, 0x2d, 0xe5, 0xcf, 0x6d, 0xa4, 0x24,
0x3e, 0xf0, 0xa1, 0x2c, 0x1a, 0xd1, 0x4e, 0xdf, 0x1c, 0x78, 0x25, 0x87, 0x15, 0x79, 0xbf, 0x4b,
0xcc, 0x5a, 0xfb, 0xb0, 0xdf, 0x54, 0x0e, 0xfb, 0x8d, 0xa6, 0x9e, 0x92, 0xb2, 0x8d, 0x24, 0x72,
0x07, 0x26, 0x65, 0xff, 0xcd, 0xc7, 0xfd, 0x82, 0x3a, 0xeb, 0x17, 0x54, 0xd5, 0x66, 0xa2, 0xd2,
0xfe, 0x70, 0xdf, 0x5c, 0xc6, 0x2a, 0xc8, 0x53, 0xdc, 0x23, 0x9e, 0xb2, 0x5b, 0xb1, 0xc5, 0x04,
0x80, 0x1f, 0x8e, 0x4e, 0x99, 0xc0, 0xc2, 0x31, 0xa1, 0xc8, 0x04, 0xfc, 0xe3, 0x76, 0xa1, 0x8f,
0x70, 0x21, 0xa9, 0x7e, 0x00, 0x13, 0x2a, 0x55, 0x19, 0xd4, 0x48, 0xa6, 0x69, 0x85, 0x69, 0xfe,
0x7f, 0x3a, 0x8c, 0x72, 0xef, 0xe8, 0xa9, 0x06, 0x29, 0x51, 0x21, 0x91, 0xd1, 0xf3, 0xb0, 0xbb,
0xc5, 0x86, 0xfe, 0x7e, 0x72, 0x03, 0x81, 0x17, 0xaf, 0xfe, 0xe2, 0xef, 0xff, 0xfd, 0xd5, 0xf0,
0x12, 0x5a, 0x30, 0xd8, 0xfa, 0xf7, 0xb8, 0xa9, 0x11, 0x12, 0x6d, 0xe8, 0x1f, 0x1a, 0xa0, 0xee,
0xfe, 0x1c, 0x6d, 0xf5, 0xdf, 0x2d, 0x56, 0x9b, 0xe8, 0x1f, 0x5f, 0xce, 0x58, 0xc2, 0xfe, 0x94,
0xc3, 0xfe, 0x04, 0x6d, 0x47, 0xc2, 0x96, 0x7d, 0x76, 0xa5, 0xa5, 0x64, 0x31, 0xe3, 0xbc, 0x4b,
0x43, 0x5c, 0xa0, 0xbf, 0x6a, 0x30, 0x1d, 0x6e, 0x79, 0xd1, 0xdd, 0xfe, 0xc8, 0x62, 0x7a, 0x6e,
0xfd, 0xa3, 0xcb, 0x98, 0x4a, 0x4a, 0xbb, 0x9c, 0xd2, 0x36, 0xda, 0x8a, 0xa4, 0x14, 0xf4, 0xda,
0x8c, 0x95, 0x98, 0x3b, 0xef, 0x6a, 0xef, 0x2f, 0xd0, 0x9f, 0x35, 0x40, 0xdd, 0x2d, 0x76, 0x92,
0x93, 0x8a, 0x6d, 0xdd, 0x93, 0x9c, 0x54, 0x7c, 0x57, 0x8f, 0x37, 0x39, 0xad, 0x0d, 0x74, 0x33,
0x92, 0x96, 0x69, 0x59, 0xe5, 0x70, 0xd3, 0x8f, 0x7e, 0xa7, 0xc1, 0x54, 0xa8, 0x29, 0x47, 0x9b,
0xfd, 0x41, 0x84, 0x4c, 0xf4, 0xbb, 0x03, 0x9b, 0x04, 0xa0, 0x6f, 0x71, 0xd0, 0x37, 0xd0, 0xb7,
0x23, 0x41, 0xbb, 0x21, 0x6c, 0xff, 0xd6, 0x60, 0x2e, 0xb2, 0x7b, 0x47, 0x3b, 0xfd, 0x21, 0xf4,
0x92, 0x0d, 0xfa, 0x27, 0x97, 0xb6, 0x4f, 0x74, 0xa9, 0xea, 0xc4, 0x2b, 0x57, 0xad, 0x06, 0xb1,
0x3d, 0xd9, 0xd2, 0x97, 0x0f, 0xa9, 0xe3, 0xdf, 0x2e, 0xbf, 0xa0, 0x5d, 0xa0, 0xdf, 0x6b, 0x30,
0xd9, 0xb1, 0x0d, 0xfa, 0x60, 0x40, 0x5c, 0x3e, 0x9f, 0x0f, 0x07, 0xb6, 0x4b, 0x74, 0x20, 0x9c,
0x47, 0x5b, 0x98, 0xa0, 0x67, 0x5a, 0x47, 0xd3, 0x8c, 0x92, 0x6d, 0xdb, 0xdd, 0xe4, 0xeb, 0x77,
0x06, 0x37, 0x94, 0x80, 0xdf, 0xe7, 0x80, 0xd7, 0xd1, 0x5a, 0x24, 0x60, 0x45, 0x66, 0x18, 0xe7,
0x5c, 0xd9, 0x5c, 0xb0, 0x5b, 0x7f, 0x45, 0xf1, 0x54, 0xb0, 0xac, 0x24, 0xb8, 0x23, 0xc5, 0x49,
0x12, 0xdc, 0xd1, 0x72, 0x03, 0xaf, 0x71, 0xdc, 0x18, 0xad, 0xf4, 0xc3, 0x8d, 0xfe, 0xa8, 0xc1,
0x54, 0xa8, 0x13, 0x4f, 0x92, 0x67, 0x62, 0x25, 0x43, 0x92, 0x3c, 0x13, 0x2f, 0x26, 0xf0, 0x7b,
0x1c, 0xf8, 0xbb, 0xe8, 0x7a, 0x24, 0xf0, 0xb0, 0xce, 0x40, 0xbf, 0xd6, 0x20, 0x25, 0xfa, 0x77,
0x94, 0x4f, 0xb4, 0x6f, 0x87, 0x84, 0xd0, 0x6f, 0x0f, 0x64, 0x93, 0xa8, 0xd6, 0x0a, 0x15, 0x81,
0xfe, 0xa2, 0xc1, 0x4c, 0x97, 0x3e, 0x40, 0x09, 0x0a, 0x4b, 0x9c, 0xec, 0xd0, 0xb7, 0x2e, 0x65,
0x2b, 0x31, 0xdf, 0xe5, 0x98, 0x6f, 0xa3, 0x4d, 0x15, 0xb3, 0xef, 0x45, 0x49, 0x89, 0x47, 0xf4,
0x49, 0x48, 0xb4, 0xa0, 0xbf, 0x69, 0x30, 0xd3, 0xa5, 0x0d, 0x92, 0x30, 0x89, 0x13, 0x27, 0x49,
0x98, 0xc4, 0x8a, 0x91, 0x3e, 0xa9, 0x50, 0x34, 0xda, 0xe1, 0x8e, 0x21, 0xa4, 0x84, 0x2e, 0xd0,
0x9f, 0x34, 0x40, 0x7b, 0xc4, 0x0b, 0xc9, 0x0d, 0x94, 0xec, 0xbd, 0x45, 0x08, 0x98, 0x24, 0x45,
0x2a, 0x46, 0xdb, 0xe0, 0x3c, 0x27, 0x74, 0x0b, 0xad, 0xc7, 0xe6, 0x44, 0x56, 0x5d, 0x05, 0x07,
0x47, 0x02, 0x7d, 0xa9, 0xc1, 0x1c, 0x77, 0xe6, 0x86, 0x44, 0x07, 0xda, 0x4e, 0x1c, 0xdb, 0x28,
0x05, 0xa4, 0xef, 0x5c, 0xd6, 0x5c, 0x92, 0xb9, 0xcf, 0xc9, 0x14, 0xd1, 0x77, 0x7a, 0x9f, 0x8e,
0x78, 0xc2, 0xa6, 0x5d, 0x2b, 0x73, 0x1d, 0xa5, 0x54, 0x29, 0xe3, 0x9c, 0x8f, 0x5c, 0xb0, 0xbc,
0x14, 0x1c, 0x91, 0xa2, 0x24, 0x3e, 0x4c, 0x18, 0xe8, 0xb0, 0x48, 0xd2, 0xef, 0x0c, 0x6e, 0x38,
0xe0, 0x01, 0x29, 0xca, 0x08, 0xfd, 0x4b, 0x83, 0x4c, 0x94, 0xc0, 0x48, 0x72, 0x3e, 0x3d, 0xb4,
0x8d, 0xbe, 0x73, 0x59, 0x73, 0xc9, 0xa5, 0xc8, 0xb9, 0x7c, 0x8c, 0x3e, 0x8a, 0xe5, 0xa2, 0xf2,
0x60, 0x47, 0xc5, 0x44, 0x14, 0x7b, 0x42, 0xbe, 0xa0, 0xba, 0x40, 0xbf, 0xd4, 0x60, 0x94, 0xff,
0x23, 0x05, 0xe5, 0x12, 0xe8, 0x14, 0xe5, 0x3f, 0x43, 0xba, 0x91, 0x78, 0xbd, 0x84, 0x8b, 0x39,
0xdc, 0x45, 0xa4, 0x47, 0xcb, 0x1a, 0xb6, 0xb6, 0xb8, 0xff, 0xfc, 0x55, 0x56, 0x7b, 0xf1, 0x2a,
0xab, 0xbd, 0x7c, 0x95, 0xd5, 0x9e, 0xbe, 0xce, 0x0e, 0xbd, 0x78, 0x9d, 0x1d, 0xfa, 0xe7, 0xeb,
0xec, 0xd0, 0x8f, 0x8c, 0x7a, 0xc3, 0x3b, 0x3a, 0xa9, 0x30, 0xd1, 0x16, 0x99, 0xf6, 0xce, 0xda,
0xae, 0xbc, 0x56, 0x93, 0xb8, 0x95, 0x14, 0xff, 0xb7, 0xd6, 0xed, 0xff, 0x07, 0x00, 0x00, 0xff,
0xff, 0x1c, 0x38, 0x4c, 0x21, 0x32, 0x1c, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type QueryClient interface {
// Parameters queries the parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Queries a list of VoterByIdentifier items.
BallotByIdentifier(ctx context.Context, in *QueryBallotByIdentifierRequest, opts ...grpc.CallOption) (*QueryBallotByIdentifierResponse, error)
// Queries a list of ObserversByChainAndType items.
ObserversByChain(ctx context.Context, in *QueryObserversByChainRequest, opts ...grpc.CallOption) (*QueryObserversByChainResponse, error)
AllObserverMappers(ctx context.Context, in *QueryAllObserverMappersRequest, opts ...grpc.CallOption) (*QueryAllObserverMappersResponse, error)
SupportedChains(ctx context.Context, in *QuerySupportedChains, opts ...grpc.CallOption) (*QuerySupportedChainsResponse, error)
// Queries a list of GetClientParamsForChain items.
GetCoreParamsForChain(ctx context.Context, in *QueryGetCoreParamsForChainRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsForChainResponse, error)
// Queries a list of GetCoreParams items.
GetCoreParams(ctx context.Context, in *QueryGetCoreParamsRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsResponse, error)
// Queries a nodeAccount by index.
NodeAccount(ctx context.Context, in *QueryGetNodeAccountRequest, opts ...grpc.CallOption) (*QueryGetNodeAccountResponse, error)
// Queries a list of nodeAccount items.
NodeAccountAll(ctx context.Context, in *QueryAllNodeAccountRequest, opts ...grpc.CallOption) (*QueryAllNodeAccountResponse, error)
CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error)
// Queries a keygen by index.
Keygen(ctx context.Context, in *QueryGetKeygenRequest, opts ...grpc.CallOption) (*QueryGetKeygenResponse, error)
// Queries a list of ShowObserverCount items.
ShowObserverCount(ctx context.Context, in *QueryShowObserverCountRequest, opts ...grpc.CallOption) (*QueryShowObserverCountResponse, error)
// Queries a list of VoterByIdentifier items.
BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error)
// Queries a list of VoterByIdentifier items.
GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error)
// Queries a list of VoterByIdentifier items.
BlamesByChainAndNonce(ctx context.Context, in *QueryBlameByChainAndNonceRequest, opts ...grpc.CallOption) (*QueryBlameByChainAndNonceResponse, error)
GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error)
GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error)
// merkle proof verification
Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) BallotByIdentifier(ctx context.Context, in *QueryBallotByIdentifierRequest, opts ...grpc.CallOption) (*QueryBallotByIdentifierResponse, error) {
out := new(QueryBallotByIdentifierResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BallotByIdentifier", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ObserversByChain(ctx context.Context, in *QueryObserversByChainRequest, opts ...grpc.CallOption) (*QueryObserversByChainResponse, error) {
out := new(QueryObserversByChainResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ObserversByChain", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) AllObserverMappers(ctx context.Context, in *QueryAllObserverMappersRequest, opts ...grpc.CallOption) (*QueryAllObserverMappersResponse, error) {
out := new(QueryAllObserverMappersResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/AllObserverMappers", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) SupportedChains(ctx context.Context, in *QuerySupportedChains, opts ...grpc.CallOption) (*QuerySupportedChainsResponse, error) {
out := new(QuerySupportedChainsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/SupportedChains", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetCoreParamsForChain(ctx context.Context, in *QueryGetCoreParamsForChainRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsForChainResponse, error) {
out := new(QueryGetCoreParamsForChainResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetCoreParamsForChain", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetCoreParams(ctx context.Context, in *QueryGetCoreParamsRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsResponse, error) {
out := new(QueryGetCoreParamsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetCoreParams", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) NodeAccount(ctx context.Context, in *QueryGetNodeAccountRequest, opts ...grpc.CallOption) (*QueryGetNodeAccountResponse, error) {
out := new(QueryGetNodeAccountResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/NodeAccount", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) NodeAccountAll(ctx context.Context, in *QueryAllNodeAccountRequest, opts ...grpc.CallOption) (*QueryAllNodeAccountResponse, error) {
out := new(QueryAllNodeAccountResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/NodeAccountAll", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error) {
out := new(QueryGetCrosschainFlagsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/CrosschainFlags", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Keygen(ctx context.Context, in *QueryGetKeygenRequest, opts ...grpc.CallOption) (*QueryGetKeygenResponse, error) {
out := new(QueryGetKeygenResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Keygen", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ShowObserverCount(ctx context.Context, in *QueryShowObserverCountRequest, opts ...grpc.CallOption) (*QueryShowObserverCountResponse, error) {
out := new(QueryShowObserverCountResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ShowObserverCount", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error) {
out := new(QueryBlameByIdentifierResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BlameByIdentifier", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error) {
out := new(QueryAllBlameRecordsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlameRecords", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) BlamesByChainAndNonce(ctx context.Context, in *QueryBlameByChainAndNonceRequest, opts ...grpc.CallOption) (*QueryBlameByChainAndNonceResponse, error) {
out := new(QueryBlameByChainAndNonceResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BlamesByChainAndNonce", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) {
out := new(QueryAllBlockHeaderResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) {
out := new(QueryGetBlockHeaderByHashResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) {
out := new(QueryProveResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Prove", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Parameters queries the parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Queries a list of VoterByIdentifier items.
BallotByIdentifier(context.Context, *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error)
// Queries a list of ObserversByChainAndType items.
ObserversByChain(context.Context, *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error)
AllObserverMappers(context.Context, *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error)
SupportedChains(context.Context, *QuerySupportedChains) (*QuerySupportedChainsResponse, error)
// Queries a list of GetClientParamsForChain items.
GetCoreParamsForChain(context.Context, *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error)
// Queries a list of GetCoreParams items.
GetCoreParams(context.Context, *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error)
// Queries a nodeAccount by index.
NodeAccount(context.Context, *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error)
// Queries a list of nodeAccount items.
NodeAccountAll(context.Context, *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error)
CrosschainFlags(context.Context, *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error)
// Queries a keygen by index.
Keygen(context.Context, *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error)
// Queries a list of ShowObserverCount items.
ShowObserverCount(context.Context, *QueryShowObserverCountRequest) (*QueryShowObserverCountResponse, error)
// Queries a list of VoterByIdentifier items.
BlameByIdentifier(context.Context, *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error)
// Queries a list of VoterByIdentifier items.
GetAllBlameRecords(context.Context, *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error)
// Queries a list of VoterByIdentifier items.
BlamesByChainAndNonce(context.Context, *QueryBlameByChainAndNonceRequest) (*QueryBlameByChainAndNonceResponse, error)
GetAllBlockHeaders(context.Context, *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error)
GetBlockHeaderByHash(context.Context, *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error)
// merkle proof verification
Prove(context.Context, *QueryProveRequest) (*QueryProveResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) BallotByIdentifier(ctx context.Context, req *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BallotByIdentifier not implemented")
}
func (*UnimplementedQueryServer) ObserversByChain(ctx context.Context, req *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ObserversByChain not implemented")
}
func (*UnimplementedQueryServer) AllObserverMappers(ctx context.Context, req *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllObserverMappers not implemented")
}
func (*UnimplementedQueryServer) SupportedChains(ctx context.Context, req *QuerySupportedChains) (*QuerySupportedChainsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SupportedChains not implemented")
}
func (*UnimplementedQueryServer) GetCoreParamsForChain(ctx context.Context, req *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCoreParamsForChain not implemented")
}
func (*UnimplementedQueryServer) GetCoreParams(ctx context.Context, req *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCoreParams not implemented")
}
func (*UnimplementedQueryServer) NodeAccount(ctx context.Context, req *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NodeAccount not implemented")
}
func (*UnimplementedQueryServer) NodeAccountAll(ctx context.Context, req *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NodeAccountAll not implemented")
}
func (*UnimplementedQueryServer) CrosschainFlags(ctx context.Context, req *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CrosschainFlags not implemented")
}
func (*UnimplementedQueryServer) Keygen(ctx context.Context, req *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Keygen not implemented")
}
func (*UnimplementedQueryServer) ShowObserverCount(ctx context.Context, req *QueryShowObserverCountRequest) (*QueryShowObserverCountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ShowObserverCount not implemented")
}
func (*UnimplementedQueryServer) BlameByIdentifier(ctx context.Context, req *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BlameByIdentifier not implemented")
}
func (*UnimplementedQueryServer) GetAllBlameRecords(ctx context.Context, req *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAllBlameRecords not implemented")
}
func (*UnimplementedQueryServer) BlamesByChainAndNonce(ctx context.Context, req *QueryBlameByChainAndNonceRequest) (*QueryBlameByChainAndNonceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BlamesByChainAndNonce not implemented")
}
func (*UnimplementedQueryServer) GetAllBlockHeaders(ctx context.Context, req *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAllBlockHeaders not implemented")
}
func (*UnimplementedQueryServer) GetBlockHeaderByHash(ctx context.Context, req *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeaderByHash not implemented")
}
func (*UnimplementedQueryServer) Prove(ctx context.Context, req *QueryProveRequest) (*QueryProveResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Prove not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_BallotByIdentifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryBallotByIdentifierRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).BallotByIdentifier(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/BallotByIdentifier",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).BallotByIdentifier(ctx, req.(*QueryBallotByIdentifierRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ObserversByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryObserversByChainRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ObserversByChain(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/ObserversByChain",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ObserversByChain(ctx, req.(*QueryObserversByChainRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_AllObserverMappers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllObserverMappersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).AllObserverMappers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/AllObserverMappers",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).AllObserverMappers(ctx, req.(*QueryAllObserverMappersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_SupportedChains_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QuerySupportedChains)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).SupportedChains(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/SupportedChains",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).SupportedChains(ctx, req.(*QuerySupportedChains))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetCoreParamsForChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetCoreParamsForChainRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetCoreParamsForChain(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/GetCoreParamsForChain",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetCoreParamsForChain(ctx, req.(*QueryGetCoreParamsForChainRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetCoreParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetCoreParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetCoreParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/GetCoreParams",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetCoreParams(ctx, req.(*QueryGetCoreParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_NodeAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetNodeAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).NodeAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/NodeAccount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).NodeAccount(ctx, req.(*QueryGetNodeAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_NodeAccountAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllNodeAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).NodeAccountAll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/NodeAccountAll",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).NodeAccountAll(ctx, req.(*QueryAllNodeAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_CrosschainFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetCrosschainFlagsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).CrosschainFlags(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/CrosschainFlags",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).CrosschainFlags(ctx, req.(*QueryGetCrosschainFlagsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Keygen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetKeygenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Keygen(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/Keygen",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Keygen(ctx, req.(*QueryGetKeygenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ShowObserverCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryShowObserverCountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ShowObserverCount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/ShowObserverCount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ShowObserverCount(ctx, req.(*QueryShowObserverCountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_BlameByIdentifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryBlameByIdentifierRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).BlameByIdentifier(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/BlameByIdentifier",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).BlameByIdentifier(ctx, req.(*QueryBlameByIdentifierRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetAllBlameRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllBlameRecordsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetAllBlameRecords(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlameRecords",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetAllBlameRecords(ctx, req.(*QueryAllBlameRecordsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_BlamesByChainAndNonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryBlameByChainAndNonceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).BlamesByChainAndNonce(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/BlamesByChainAndNonce",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).BlamesByChainAndNonce(ctx, req.(*QueryBlameByChainAndNonceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetAllBlockHeaders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllBlockHeaderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetAllBlockHeaders(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlockHeaders",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetAllBlockHeaders(ctx, req.(*QueryAllBlockHeaderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetBlockHeaderByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetBlockHeaderByHashRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetBlockHeaderByHash(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetBlockHeaderByHash(ctx, req.(*QueryGetBlockHeaderByHashRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Prove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryProveRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Prove(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Query/Prove",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Prove(ctx, req.(*QueryProveRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.observer.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "BallotByIdentifier",
Handler: _Query_BallotByIdentifier_Handler,
},
{
MethodName: "ObserversByChain",
Handler: _Query_ObserversByChain_Handler,
},
{
MethodName: "AllObserverMappers",
Handler: _Query_AllObserverMappers_Handler,
},
{
MethodName: "SupportedChains",
Handler: _Query_SupportedChains_Handler,
},
{
MethodName: "GetCoreParamsForChain",
Handler: _Query_GetCoreParamsForChain_Handler,
},
{
MethodName: "GetCoreParams",
Handler: _Query_GetCoreParams_Handler,
},
{
MethodName: "NodeAccount",
Handler: _Query_NodeAccount_Handler,
},
{
MethodName: "NodeAccountAll",
Handler: _Query_NodeAccountAll_Handler,
},
{
MethodName: "CrosschainFlags",
Handler: _Query_CrosschainFlags_Handler,
},
{
MethodName: "Keygen",
Handler: _Query_Keygen_Handler,
},
{
MethodName: "ShowObserverCount",
Handler: _Query_ShowObserverCount_Handler,
},
{
MethodName: "BlameByIdentifier",
Handler: _Query_BlameByIdentifier_Handler,
},
{
MethodName: "GetAllBlameRecords",
Handler: _Query_GetAllBlameRecords_Handler,
},
{
MethodName: "BlamesByChainAndNonce",
Handler: _Query_BlamesByChainAndNonce_Handler,
},
{
MethodName: "GetAllBlockHeaders",
Handler: _Query_GetAllBlockHeaders_Handler,
},
{
MethodName: "GetBlockHeaderByHash",
Handler: _Query_GetBlockHeaderByHash_Handler,
},
{
MethodName: "Prove",
Handler: _Query_Prove_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "observer/query.proto",
}
func (m *QueryProveRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryProveRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryProveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.TxIndex != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex))
i--
dAtA[i] = 0x28
}
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0x22
}
if m.Proof != nil {
{
size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if len(m.TxHash) > 0 {
i -= len(m.TxHash)
copy(dAtA[i:], m.TxHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.TxHash)))
i--
dAtA[i] = 0x12
}
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryProveResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryProveResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryProveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Valid {
i--
if m.Valid {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryBallotByIdentifierRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryBallotByIdentifierRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryBallotByIdentifierRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BallotIdentifier) > 0 {
i -= len(m.BallotIdentifier)
copy(dAtA[i:], m.BallotIdentifier)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BallotIdentifier)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *VoterList) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *VoterList) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *VoterList) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.VoteType != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.VoteType))
i--
dAtA[i] = 0x10
}
if len(m.VoterAddress) > 0 {
i -= len(m.VoterAddress)
copy(dAtA[i:], m.VoterAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.VoterAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryBallotByIdentifierResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryBallotByIdentifierResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryBallotByIdentifierResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BallotStatus != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.BallotStatus))
i--
dAtA[i] = 0x20
}
if m.ObservationType != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ObservationType))
i--
dAtA[i] = 0x18
}
if len(m.Voters) > 0 {
for iNdEx := len(m.Voters) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Voters[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.BallotIdentifier) > 0 {
i -= len(m.BallotIdentifier)
copy(dAtA[i:], m.BallotIdentifier)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BallotIdentifier)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryObserversByChainRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryObserversByChainRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryObserversByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ObservationChain) > 0 {
i -= len(m.ObservationChain)
copy(dAtA[i:], m.ObservationChain)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ObservationChain)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryObserversByChainResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryObserversByChainResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryObserversByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Observers) > 0 {
for iNdEx := len(m.Observers) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Observers[iNdEx])
copy(dAtA[i:], m.Observers[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.Observers[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllObserverMappersRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllObserverMappersRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllObserverMappersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryAllObserverMappersResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllObserverMappersResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllObserverMappersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ObserverMappers) > 0 {
for iNdEx := len(m.ObserverMappers) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.ObserverMappers[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QuerySupportedChains) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QuerySupportedChains) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QuerySupportedChains) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QuerySupportedChainsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QuerySupportedChainsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QuerySupportedChainsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Chains) > 0 {
for iNdEx := len(m.Chains) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Chains[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetCoreParamsForChainRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCoreParamsForChainRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCoreParamsForChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryGetCoreParamsForChainResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCoreParamsForChainResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCoreParamsForChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.CoreParams != nil {
{
size, err := m.CoreParams.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetCoreParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCoreParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCoreParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryGetCoreParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCoreParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCoreParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.CoreParams != nil {
{
size, err := m.CoreParams.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetNodeAccountRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetNodeAccountRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetNodeAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Index) > 0 {
i -= len(m.Index)
copy(dAtA[i:], m.Index)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Index)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetNodeAccountResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetNodeAccountResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetNodeAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.NodeAccount != nil {
{
size, err := m.NodeAccount.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllNodeAccountRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllNodeAccountRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllNodeAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllNodeAccountResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllNodeAccountResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllNodeAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.NodeAccount) > 0 {
for iNdEx := len(m.NodeAccount) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.NodeAccount[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetCrosschainFlagsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCrosschainFlagsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCrosschainFlagsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryGetCrosschainFlagsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetCrosschainFlagsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetCrosschainFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.CrosschainFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryGetKeygenRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetKeygenRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetKeygenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryGetKeygenResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetKeygenResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetKeygenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Keygen != nil {
{
size, err := m.Keygen.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryShowObserverCountRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryShowObserverCountRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryShowObserverCountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryShowObserverCountResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryShowObserverCountResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryShowObserverCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.LastObserverCount != nil {
{
size, err := m.LastObserverCount.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryBlameByIdentifierRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryBlameByIdentifierRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryBlameByIdentifierRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BlameIdentifier) > 0 {
i -= len(m.BlameIdentifier)
copy(dAtA[i:], m.BlameIdentifier)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlameIdentifier)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryBlameByIdentifierResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryBlameByIdentifierResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryBlameByIdentifierResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlameInfo != nil {
{
size, err := m.BlameInfo.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllBlameRecordsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllBlameRecordsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllBlameRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryAllBlameRecordsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllBlameRecordsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllBlameRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BlameInfo) > 0 {
for iNdEx := len(m.BlameInfo) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.BlameInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryBlameByChainAndNonceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryBlameByChainAndNonceRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryBlameByChainAndNonceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Nonce != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Nonce))
i--
dAtA[i] = 0x10
}
if m.ChainId != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryBlameByChainAndNonceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryBlameByChainAndNonceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryBlameByChainAndNonceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BlameInfo) > 0 {
for iNdEx := len(m.BlameInfo) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.BlameInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryAllBlockHeaderRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllBlockHeaderRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllBlockHeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryAllBlockHeaderResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryAllBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryAllBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.BlockHeaders) > 0 {
for iNdEx := len(m.BlockHeaders) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.BlockHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryGetBlockHeaderByHashRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetBlockHeaderByHashRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetBlockHeaderByHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryGetBlockHeaderByHashResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryGetBlockHeaderByHashResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetBlockHeaderByHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockHeader != nil {
{
size, err := m.BlockHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *QueryProveRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
l = len(m.TxHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Proof != nil {
l = m.Proof.Size()
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.TxIndex != 0 {
n += 1 + sovQuery(uint64(m.TxIndex))
}
return n
}
func (m *QueryProveResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Valid {
n += 2
}
return n
}
func (m *QueryParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryBallotByIdentifierRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.BallotIdentifier)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *VoterList) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.VoterAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.VoteType != 0 {
n += 1 + sovQuery(uint64(m.VoteType))
}
return n
}
func (m *QueryBallotByIdentifierResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.BallotIdentifier)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if len(m.Voters) > 0 {
for _, e := range m.Voters {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.ObservationType != 0 {
n += 1 + sovQuery(uint64(m.ObservationType))
}
if m.BallotStatus != 0 {
n += 1 + sovQuery(uint64(m.BallotStatus))
}
return n
}
func (m *QueryObserversByChainRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ObservationChain)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryObserversByChainResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Observers) > 0 {
for _, s := range m.Observers {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryAllObserverMappersRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryAllObserverMappersResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.ObserverMappers) > 0 {
for _, e := range m.ObserverMappers {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QuerySupportedChains) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QuerySupportedChainsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Chains) > 0 {
for _, e := range m.Chains {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryGetCoreParamsForChainRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
return n
}
func (m *QueryGetCoreParamsForChainResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.CoreParams != nil {
l = m.CoreParams.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetCoreParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryGetCoreParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.CoreParams != nil {
l = m.CoreParams.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetNodeAccountRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Index)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetNodeAccountResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.NodeAccount != nil {
l = m.NodeAccount.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllNodeAccountRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllNodeAccountResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.NodeAccount) > 0 {
for _, e := range m.NodeAccount {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetCrosschainFlagsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryGetCrosschainFlagsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.CrosschainFlags.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryGetKeygenRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryGetKeygenResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Keygen != nil {
l = m.Keygen.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryShowObserverCountRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryShowObserverCountResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.LastObserverCount != nil {
l = m.LastObserverCount.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryBlameByIdentifierRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.BlameIdentifier)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryBlameByIdentifierResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BlameInfo != nil {
l = m.BlameInfo.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllBlameRecordsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryAllBlameRecordsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.BlameInfo) > 0 {
for _, e := range m.BlameInfo {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryBlameByChainAndNonceRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ChainId != 0 {
n += 1 + sovQuery(uint64(m.ChainId))
}
if m.Nonce != 0 {
n += 1 + sovQuery(uint64(m.Nonce))
}
return n
}
func (m *QueryBlameByChainAndNonceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.BlameInfo) > 0 {
for _, e := range m.BlameInfo {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryAllBlockHeaderRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryAllBlockHeaderResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.BlockHeaders) > 0 {
for _, e := range m.BlockHeaders {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetBlockHeaderByHashRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetBlockHeaderByHashResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BlockHeader != nil {
l = m.BlockHeader.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *QueryProveRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryProveRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryProveRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Proof == nil {
m.Proof = &common.Proof{}
}
if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType)
}
m.TxIndex = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.TxIndex |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryProveResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryProveResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryProveResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Valid", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Valid = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryBallotByIdentifierRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryBallotByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *VoterList) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: VoterList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: VoterList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field VoterAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.VoterAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field VoteType", wireType)
}
m.VoteType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.VoteType |= VoteType(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryBallotByIdentifierResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryBallotByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Voters", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Voters = append(m.Voters, &VoterList{})
if err := m.Voters[len(m.Voters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservationType", wireType)
}
m.ObservationType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ObservationType |= ObservationType(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BallotStatus", wireType)
}
m.BallotStatus = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BallotStatus |= BallotStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryObserversByChainRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryObserversByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObservationChain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObservationChain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryObserversByChainResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryObserversByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Observers", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Observers = append(m.Observers, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllObserverMappersRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllObserverMappersRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllObserverMappersResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllObserverMappersResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverMappers", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverMappers = append(m.ObserverMappers, &ObserverMapper{})
if err := m.ObserverMappers[len(m.ObserverMappers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QuerySupportedChains: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QuerySupportedChains: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QuerySupportedChainsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QuerySupportedChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Chains = append(m.Chains, &common.Chain{})
if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.CoreParams == nil {
m.CoreParams = &CoreParams{}
}
if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCoreParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCoreParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCoreParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCoreParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.CoreParams == nil {
m.CoreParams = &CoreParamsList{}
}
if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetNodeAccountRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Index = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetNodeAccountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.NodeAccount == nil {
m.NodeAccount = &NodeAccount{}
}
if err := m.NodeAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllNodeAccountRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllNodeAccountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NodeAccount = append(m.NodeAccount, &NodeAccount{})
if err := m.NodeAccount[len(m.NodeAccount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCrosschainFlagsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCrosschainFlagsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCrosschainFlagsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetCrosschainFlagsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetCrosschainFlagsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetCrosschainFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CrosschainFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.CrosschainFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetKeygenRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetKeygenRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetKeygenResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Keygen", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Keygen == nil {
m.Keygen = &Keygen{}
}
if err := m.Keygen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryShowObserverCountRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryShowObserverCountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryShowObserverCountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryShowObserverCountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LastObserverCount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.LastObserverCount == nil {
m.LastObserverCount = &LastObserverCount{}
}
if err := m.LastObserverCount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryBlameByIdentifierRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryBlameByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlameIdentifier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlameIdentifier = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryBlameByIdentifierResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryBlameByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BlameInfo == nil {
m.BlameInfo = &Blame{}
}
if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllBlameRecordsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllBlameRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllBlameRecordsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllBlameRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlameInfo = append(m.BlameInfo, &Blame{})
if err := m.BlameInfo[len(m.BlameInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryBlameByChainAndNonceRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryBlameByChainAndNonceRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryBlameByChainAndNonceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
m.Nonce = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Nonce |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryBlameByChainAndNonceResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryBlameByChainAndNonceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryBlameByChainAndNonceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlameInfo = append(m.BlameInfo, &Blame{})
if err := m.BlameInfo[len(m.BlameInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllBlockHeaderRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllBlockHeaderRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllBlockHeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryAllBlockHeaderResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryAllBlockHeaderResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryAllBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeaders", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHeaders = append(m.BlockHeaders, &common.BlockHeader{})
if err := m.BlockHeaders[len(m.BlockHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetBlockHeaderByHashRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetBlockHeaderByHashRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetBlockHeaderByHashRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...)
if m.BlockHash == nil {
m.BlockHash = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetBlockHeaderByHashResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryGetBlockHeaderByHashResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetBlockHeaderByHashResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BlockHeader == nil {
m.BlockHeader = &common.BlockHeader{}
}
if err := m.BlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthQuery
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupQuery
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthQuery
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: observer/query.proto
/*
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package types
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := server.Params(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_BallotByIdentifier_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryBallotByIdentifierRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["ballot_identifier"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "ballot_identifier")
}
protoReq.BallotIdentifier, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ballot_identifier", err)
}
msg, err := client.BallotByIdentifier(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_BallotByIdentifier_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryBallotByIdentifierRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["ballot_identifier"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "ballot_identifier")
}
protoReq.BallotIdentifier, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ballot_identifier", err)
}
msg, err := server.BallotByIdentifier(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_ObserversByChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryObserversByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["observation_chain"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "observation_chain")
}
protoReq.ObservationChain, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "observation_chain", err)
}
msg, err := client.ObserversByChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ObserversByChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryObserversByChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["observation_chain"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "observation_chain")
}
protoReq.ObservationChain, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "observation_chain", err)
}
msg, err := server.ObserversByChain(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_AllObserverMappers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllObserverMappersRequest
var metadata runtime.ServerMetadata
msg, err := client.AllObserverMappers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_AllObserverMappers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllObserverMappersRequest
var metadata runtime.ServerMetadata
msg, err := server.AllObserverMappers(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_SupportedChains_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySupportedChains
var metadata runtime.ServerMetadata
msg, err := client.SupportedChains(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_SupportedChains_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySupportedChains
var metadata runtime.ServerMetadata
msg, err := server.SupportedChains(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GetCoreParamsForChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCoreParamsForChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
msg, err := client.GetCoreParamsForChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetCoreParamsForChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCoreParamsForChainRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
msg, err := server.GetCoreParamsForChain(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GetCoreParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCoreParamsRequest
var metadata runtime.ServerMetadata
msg, err := client.GetCoreParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetCoreParams_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCoreParamsRequest
var metadata runtime.ServerMetadata
msg, err := server.GetCoreParams(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_NodeAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetNodeAccountRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := client.NodeAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_NodeAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetNodeAccountRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["index"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index")
}
protoReq.Index, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err)
}
msg, err := server.NodeAccount(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_NodeAccountAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_NodeAccountAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllNodeAccountRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NodeAccountAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.NodeAccountAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_NodeAccountAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllNodeAccountRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NodeAccountAll_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.NodeAccountAll(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_CrosschainFlags_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCrosschainFlagsRequest
var metadata runtime.ServerMetadata
msg, err := client.CrosschainFlags(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_CrosschainFlags_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetCrosschainFlagsRequest
var metadata runtime.ServerMetadata
msg, err := server.CrosschainFlags(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_Keygen_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetKeygenRequest
var metadata runtime.ServerMetadata
msg, err := client.Keygen(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Keygen_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetKeygenRequest
var metadata runtime.ServerMetadata
msg, err := server.Keygen(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_ShowObserverCount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryShowObserverCountRequest
var metadata runtime.ServerMetadata
msg, err := client.ShowObserverCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ShowObserverCount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryShowObserverCountRequest
var metadata runtime.ServerMetadata
msg, err := server.ShowObserverCount(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_BlameByIdentifier_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryBlameByIdentifierRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["blame_identifier"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blame_identifier")
}
protoReq.BlameIdentifier, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blame_identifier", err)
}
msg, err := client.BlameByIdentifier(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_BlameByIdentifier_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryBlameByIdentifierRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["blame_identifier"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blame_identifier")
}
protoReq.BlameIdentifier, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blame_identifier", err)
}
msg, err := server.BlameByIdentifier(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GetAllBlameRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllBlameRecordsRequest
var metadata runtime.ServerMetadata
msg, err := client.GetAllBlameRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetAllBlameRecords_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllBlameRecordsRequest
var metadata runtime.ServerMetadata
msg, err := server.GetAllBlameRecords(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_BlamesByChainAndNonce_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryBlameByChainAndNonceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
val, ok = pathParams["nonce"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonce")
}
protoReq.Nonce, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonce", err)
}
msg, err := client.BlamesByChainAndNonce(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_BlamesByChainAndNonce_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryBlameByChainAndNonceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["chain_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
}
protoReq.ChainId, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
}
val, ok = pathParams["nonce"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonce")
}
protoReq.Nonce, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonce", err)
}
msg, err := server.BlamesByChainAndNonce(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_GetAllBlockHeaders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_GetAllBlockHeaders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllBlockHeaderRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllBlockHeaders_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetAllBlockHeaders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetAllBlockHeaders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAllBlockHeaderRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllBlockHeaders_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetAllBlockHeaders(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GetBlockHeaderByHash_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetBlockHeaderByHashRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["block_hash"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "block_hash")
}
protoReq.BlockHash, err = runtime.Bytes(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "block_hash", err)
}
msg, err := client.GetBlockHeaderByHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetBlockHeaderByHash_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetBlockHeaderByHashRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["block_hash"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "block_hash")
}
protoReq.BlockHash, err = runtime.Bytes(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "block_hash", err)
}
msg, err := server.GetBlockHeaderByHash(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_Prove_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryProveRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Prove_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Prove(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryProveRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Prove_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Prove(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_BallotByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_BallotByIdentifier_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_BallotByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ObserversByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ObserversByChain_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ObserversByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_AllObserverMappers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_AllObserverMappers_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_AllObserverMappers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_SupportedChains_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_SupportedChains_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_SupportedChains_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetCoreParamsForChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetCoreParamsForChain_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetCoreParamsForChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetCoreParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetCoreParams_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetCoreParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_NodeAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_NodeAccount_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_NodeAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_NodeAccountAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_NodeAccountAll_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_NodeAccountAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CrosschainFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_CrosschainFlags_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CrosschainFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Keygen_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Keygen_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Keygen_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ShowObserverCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ShowObserverCount_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ShowObserverCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_BlameByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_BlameByIdentifier_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_BlameByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetAllBlameRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetAllBlameRecords_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetAllBlameRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_BlamesByChainAndNonce_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_BlamesByChainAndNonce_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_BlamesByChainAndNonce_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetAllBlockHeaders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetAllBlockHeaders_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetBlockHeaderByHash_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Prove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Prove_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterQueryHandler(ctx, mux, conn)
}
// RegisterQueryHandler registers the http handlers for service Query to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
}
// RegisterQueryHandlerClient registers the http handlers for service Query
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_BallotByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_BallotByIdentifier_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_BallotByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ObserversByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ObserversByChain_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ObserversByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_AllObserverMappers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_AllObserverMappers_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_AllObserverMappers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_SupportedChains_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_SupportedChains_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_SupportedChains_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetCoreParamsForChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetCoreParamsForChain_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetCoreParamsForChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetCoreParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetCoreParams_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetCoreParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_NodeAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_NodeAccount_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_NodeAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_NodeAccountAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_NodeAccountAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_NodeAccountAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_CrosschainFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_CrosschainFlags_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_CrosschainFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Keygen_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Keygen_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Keygen_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_ShowObserverCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ShowObserverCount_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ShowObserverCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_BlameByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_BlameByIdentifier_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_BlameByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetAllBlameRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetAllBlameRecords_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetAllBlameRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_BlamesByChainAndNonce_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_BlamesByChainAndNonce_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_BlamesByChainAndNonce_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetAllBlockHeaders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetAllBlockHeaders_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetBlockHeaderByHash_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Prove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Prove_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_BallotByIdentifier_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "ballot_by_identifier", "ballot_identifier"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ObserversByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "observers_by_chain", "observation_chain"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_AllObserverMappers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "all_observer_mappers"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_SupportedChains_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "supportedChains"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetCoreParamsForChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "get_client_params_for_chain", "chain_id"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetCoreParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_core_params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_NodeAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "nodeAccount", "index"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_NodeAccountAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "nodeAccount"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_CrosschainFlags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "crosschain_flags"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Keygen_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "keygen"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ShowObserverCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"zeta-chain", "zetacore", "observer", "show_observer_count"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_BlameByIdentifier_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "blame_by_identifier", "blame_identifier"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetAllBlameRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_all_blame_records"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_BlamesByChainAndNonce_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"zeta-chain", "observer", "blame_by_chain_and_nonce", "chain_id", "nonce"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetAllBlockHeaders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_all_block_headers"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetBlockHeaderByHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "get_block_header_by_hash", "block_hash"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Prove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "prove"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_BallotByIdentifier_0 = runtime.ForwardResponseMessage
forward_Query_ObserversByChain_0 = runtime.ForwardResponseMessage
forward_Query_AllObserverMappers_0 = runtime.ForwardResponseMessage
forward_Query_SupportedChains_0 = runtime.ForwardResponseMessage
forward_Query_GetCoreParamsForChain_0 = runtime.ForwardResponseMessage
forward_Query_GetCoreParams_0 = runtime.ForwardResponseMessage
forward_Query_NodeAccount_0 = runtime.ForwardResponseMessage
forward_Query_NodeAccountAll_0 = runtime.ForwardResponseMessage
forward_Query_CrosschainFlags_0 = runtime.ForwardResponseMessage
forward_Query_Keygen_0 = runtime.ForwardResponseMessage
forward_Query_ShowObserverCount_0 = runtime.ForwardResponseMessage
forward_Query_BlameByIdentifier_0 = runtime.ForwardResponseMessage
forward_Query_GetAllBlameRecords_0 = runtime.ForwardResponseMessage
forward_Query_BlamesByChainAndNonce_0 = runtime.ForwardResponseMessage
forward_Query_GetAllBlockHeaders_0 = runtime.ForwardResponseMessage
forward_Query_GetBlockHeaderByHash_0 = runtime.ForwardResponseMessage
forward_Query_Prove_0 = runtime.ForwardResponseMessage
)
package types
import (
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/crypto"
"github.com/zeta-chain/zetacore/common"
)
func CreateObserverMapperList(items int, chain common.Chain) (list []*ObserverMapper) {
SetConfig(false)
for i := 0; i < items; i++ {
mapper := &ObserverMapper{
Index: "Index" + strconv.Itoa(i),
ObserverChain: &chain,
ObserverList: []string{
sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i)))).String(),
sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i+1)))).String(),
sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i+2)))).String(),
sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i+3)))).String(),
},
}
list = append(list, mapper)
}
return
}
const (
AccountAddressPrefix = "zeta"
)
var (
AccountPubKeyPrefix = AccountAddressPrefix + "pub"
ValidatorAddressPrefix = AccountAddressPrefix + "valoper"
ValidatorPubKeyPrefix = AccountAddressPrefix + "valoperpub"
ConsNodeAddressPrefix = AccountAddressPrefix + "valcons"
ConsNodePubKeyPrefix = AccountAddressPrefix + "valconspub"
)
func SetConfig(seal bool) {
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(AccountAddressPrefix, AccountPubKeyPrefix)
config.SetBech32PrefixForValidator(ValidatorAddressPrefix, ValidatorPubKeyPrefix)
config.SetBech32PrefixForConsensusNode(ConsNodeAddressPrefix, ConsNodePubKeyPrefix)
if seal {
config.Seal()
}
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: observer/tx.proto
package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
common "github.com/zeta-chain/zetacore/common"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type MsgAddBlockHeader struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
Height int64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
Header common.HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"`
}
func (m *MsgAddBlockHeader) Reset() { *m = MsgAddBlockHeader{} }
func (m *MsgAddBlockHeader) String() string { return proto.CompactTextString(m) }
func (*MsgAddBlockHeader) ProtoMessage() {}
func (*MsgAddBlockHeader) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{0}
}
func (m *MsgAddBlockHeader) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddBlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddBlockHeader.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddBlockHeader) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddBlockHeader.Merge(m, src)
}
func (m *MsgAddBlockHeader) XXX_Size() int {
return m.Size()
}
func (m *MsgAddBlockHeader) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddBlockHeader.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddBlockHeader proto.InternalMessageInfo
func (m *MsgAddBlockHeader) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgAddBlockHeader) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgAddBlockHeader) GetBlockHash() []byte {
if m != nil {
return m.BlockHash
}
return nil
}
func (m *MsgAddBlockHeader) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
func (m *MsgAddBlockHeader) GetHeader() common.HeaderData {
if m != nil {
return m.Header
}
return common.HeaderData{}
}
type MsgAddBlockHeaderResponse struct {
}
func (m *MsgAddBlockHeaderResponse) Reset() { *m = MsgAddBlockHeaderResponse{} }
func (m *MsgAddBlockHeaderResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAddBlockHeaderResponse) ProtoMessage() {}
func (*MsgAddBlockHeaderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{1}
}
func (m *MsgAddBlockHeaderResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddBlockHeaderResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddBlockHeaderResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddBlockHeaderResponse.Merge(m, src)
}
func (m *MsgAddBlockHeaderResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgAddBlockHeaderResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddBlockHeaderResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddBlockHeaderResponse proto.InternalMessageInfo
type MsgUpdateCoreParams struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
CoreParams *CoreParams `protobuf:"bytes,2,opt,name=coreParams,proto3" json:"coreParams,omitempty"`
}
func (m *MsgUpdateCoreParams) Reset() { *m = MsgUpdateCoreParams{} }
func (m *MsgUpdateCoreParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateCoreParams) ProtoMessage() {}
func (*MsgUpdateCoreParams) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{2}
}
func (m *MsgUpdateCoreParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateCoreParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateCoreParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateCoreParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateCoreParams.Merge(m, src)
}
func (m *MsgUpdateCoreParams) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateCoreParams) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateCoreParams.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateCoreParams proto.InternalMessageInfo
func (m *MsgUpdateCoreParams) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateCoreParams) GetCoreParams() *CoreParams {
if m != nil {
return m.CoreParams
}
return nil
}
type MsgUpdateCoreParamsResponse struct {
}
func (m *MsgUpdateCoreParamsResponse) Reset() { *m = MsgUpdateCoreParamsResponse{} }
func (m *MsgUpdateCoreParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateCoreParamsResponse) ProtoMessage() {}
func (*MsgUpdateCoreParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{3}
}
func (m *MsgUpdateCoreParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateCoreParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateCoreParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateCoreParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateCoreParamsResponse.Merge(m, src)
}
func (m *MsgUpdateCoreParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateCoreParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateCoreParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateCoreParamsResponse proto.InternalMessageInfo
type MsgAddObserver struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ObserverAddress string `protobuf:"bytes,2,opt,name=observer_address,json=observerAddress,proto3" json:"observer_address,omitempty"`
ZetaclientGranteePubkey string `protobuf:"bytes,3,opt,name=zetaclient_grantee_pubkey,json=zetaclientGranteePubkey,proto3" json:"zetaclient_grantee_pubkey,omitempty"`
AddNodeAccountOnly bool `protobuf:"varint,4,opt,name=add_node_account_only,json=addNodeAccountOnly,proto3" json:"add_node_account_only,omitempty"`
}
func (m *MsgAddObserver) Reset() { *m = MsgAddObserver{} }
func (m *MsgAddObserver) String() string { return proto.CompactTextString(m) }
func (*MsgAddObserver) ProtoMessage() {}
func (*MsgAddObserver) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{4}
}
func (m *MsgAddObserver) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddObserver) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddObserver.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddObserver) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddObserver.Merge(m, src)
}
func (m *MsgAddObserver) XXX_Size() int {
return m.Size()
}
func (m *MsgAddObserver) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddObserver.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddObserver proto.InternalMessageInfo
func (m *MsgAddObserver) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgAddObserver) GetObserverAddress() string {
if m != nil {
return m.ObserverAddress
}
return ""
}
func (m *MsgAddObserver) GetZetaclientGranteePubkey() string {
if m != nil {
return m.ZetaclientGranteePubkey
}
return ""
}
func (m *MsgAddObserver) GetAddNodeAccountOnly() bool {
if m != nil {
return m.AddNodeAccountOnly
}
return false
}
type MsgAddObserverResponse struct {
}
func (m *MsgAddObserverResponse) Reset() { *m = MsgAddObserverResponse{} }
func (m *MsgAddObserverResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAddObserverResponse) ProtoMessage() {}
func (*MsgAddObserverResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{5}
}
func (m *MsgAddObserverResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddObserverResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddObserverResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddObserverResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddObserverResponse.Merge(m, src)
}
func (m *MsgAddObserverResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgAddObserverResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddObserverResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddObserverResponse proto.InternalMessageInfo
type MsgAddBlameVote struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
BlameInfo *Blame `protobuf:"bytes,3,opt,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"`
}
func (m *MsgAddBlameVote) Reset() { *m = MsgAddBlameVote{} }
func (m *MsgAddBlameVote) String() string { return proto.CompactTextString(m) }
func (*MsgAddBlameVote) ProtoMessage() {}
func (*MsgAddBlameVote) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{6}
}
func (m *MsgAddBlameVote) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddBlameVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddBlameVote.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddBlameVote) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddBlameVote.Merge(m, src)
}
func (m *MsgAddBlameVote) XXX_Size() int {
return m.Size()
}
func (m *MsgAddBlameVote) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddBlameVote.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddBlameVote proto.InternalMessageInfo
func (m *MsgAddBlameVote) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgAddBlameVote) GetChainId() int64 {
if m != nil {
return m.ChainId
}
return 0
}
func (m *MsgAddBlameVote) GetBlameInfo() *Blame {
if m != nil {
return m.BlameInfo
}
return nil
}
type MsgAddBlameVoteResponse struct {
}
func (m *MsgAddBlameVoteResponse) Reset() { *m = MsgAddBlameVoteResponse{} }
func (m *MsgAddBlameVoteResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAddBlameVoteResponse) ProtoMessage() {}
func (*MsgAddBlameVoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{7}
}
func (m *MsgAddBlameVoteResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAddBlameVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAddBlameVoteResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAddBlameVoteResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAddBlameVoteResponse.Merge(m, src)
}
func (m *MsgAddBlameVoteResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgAddBlameVoteResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAddBlameVoteResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAddBlameVoteResponse proto.InternalMessageInfo
type MsgUpdateCrosschainFlags struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
IsInboundEnabled bool `protobuf:"varint,3,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
IsOutboundEnabled bool `protobuf:"varint,4,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,5,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"`
BlockHeaderVerificationFlags *BlockHeaderVerificationFlags `protobuf:"bytes,6,opt,name=blockHeaderVerificationFlags,proto3" json:"blockHeaderVerificationFlags,omitempty"`
}
func (m *MsgUpdateCrosschainFlags) Reset() { *m = MsgUpdateCrosschainFlags{} }
func (m *MsgUpdateCrosschainFlags) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateCrosschainFlags) ProtoMessage() {}
func (*MsgUpdateCrosschainFlags) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{8}
}
func (m *MsgUpdateCrosschainFlags) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateCrosschainFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateCrosschainFlags.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateCrosschainFlags) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateCrosschainFlags.Merge(m, src)
}
func (m *MsgUpdateCrosschainFlags) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateCrosschainFlags) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateCrosschainFlags.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateCrosschainFlags proto.InternalMessageInfo
func (m *MsgUpdateCrosschainFlags) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateCrosschainFlags) GetIsInboundEnabled() bool {
if m != nil {
return m.IsInboundEnabled
}
return false
}
func (m *MsgUpdateCrosschainFlags) GetIsOutboundEnabled() bool {
if m != nil {
return m.IsOutboundEnabled
}
return false
}
func (m *MsgUpdateCrosschainFlags) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags {
if m != nil {
return m.GasPriceIncreaseFlags
}
return nil
}
func (m *MsgUpdateCrosschainFlags) GetBlockHeaderVerificationFlags() *BlockHeaderVerificationFlags {
if m != nil {
return m.BlockHeaderVerificationFlags
}
return nil
}
type MsgUpdateCrosschainFlagsResponse struct {
}
func (m *MsgUpdateCrosschainFlagsResponse) Reset() { *m = MsgUpdateCrosschainFlagsResponse{} }
func (m *MsgUpdateCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateCrosschainFlagsResponse) ProtoMessage() {}
func (*MsgUpdateCrosschainFlagsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{9}
}
func (m *MsgUpdateCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateCrosschainFlagsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.Merge(m, src)
}
func (m *MsgUpdateCrosschainFlagsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateCrosschainFlagsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateCrosschainFlagsResponse proto.InternalMessageInfo
type MsgUpdateKeygen struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Block int64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"`
}
func (m *MsgUpdateKeygen) Reset() { *m = MsgUpdateKeygen{} }
func (m *MsgUpdateKeygen) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateKeygen) ProtoMessage() {}
func (*MsgUpdateKeygen) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{10}
}
func (m *MsgUpdateKeygen) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateKeygen) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateKeygen.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateKeygen) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateKeygen.Merge(m, src)
}
func (m *MsgUpdateKeygen) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateKeygen) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateKeygen.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateKeygen proto.InternalMessageInfo
func (m *MsgUpdateKeygen) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgUpdateKeygen) GetBlock() int64 {
if m != nil {
return m.Block
}
return 0
}
type MsgUpdateKeygenResponse struct {
}
func (m *MsgUpdateKeygenResponse) Reset() { *m = MsgUpdateKeygenResponse{} }
func (m *MsgUpdateKeygenResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateKeygenResponse) ProtoMessage() {}
func (*MsgUpdateKeygenResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_1bcd40fa296a2b1d, []int{11}
}
func (m *MsgUpdateKeygenResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateKeygenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateKeygenResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateKeygenResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateKeygenResponse.Merge(m, src)
}
func (m *MsgUpdateKeygenResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateKeygenResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateKeygenResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateKeygenResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgAddBlockHeader)(nil), "zetachain.zetacore.observer.MsgAddBlockHeader")
proto.RegisterType((*MsgAddBlockHeaderResponse)(nil), "zetachain.zetacore.observer.MsgAddBlockHeaderResponse")
proto.RegisterType((*MsgUpdateCoreParams)(nil), "zetachain.zetacore.observer.MsgUpdateCoreParams")
proto.RegisterType((*MsgUpdateCoreParamsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateCoreParamsResponse")
proto.RegisterType((*MsgAddObserver)(nil), "zetachain.zetacore.observer.MsgAddObserver")
proto.RegisterType((*MsgAddObserverResponse)(nil), "zetachain.zetacore.observer.MsgAddObserverResponse")
proto.RegisterType((*MsgAddBlameVote)(nil), "zetachain.zetacore.observer.MsgAddBlameVote")
proto.RegisterType((*MsgAddBlameVoteResponse)(nil), "zetachain.zetacore.observer.MsgAddBlameVoteResponse")
proto.RegisterType((*MsgUpdateCrosschainFlags)(nil), "zetachain.zetacore.observer.MsgUpdateCrosschainFlags")
proto.RegisterType((*MsgUpdateCrosschainFlagsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateCrosschainFlagsResponse")
proto.RegisterType((*MsgUpdateKeygen)(nil), "zetachain.zetacore.observer.MsgUpdateKeygen")
proto.RegisterType((*MsgUpdateKeygenResponse)(nil), "zetachain.zetacore.observer.MsgUpdateKeygenResponse")
}
func init() { proto.RegisterFile("observer/tx.proto", fileDescriptor_1bcd40fa296a2b1d) }
var fileDescriptor_1bcd40fa296a2b1d = []byte{
// 803 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4b, 0x4f, 0xeb, 0x46,
0x14, 0x8e, 0x2f, 0x17, 0x2e, 0x39, 0x41, 0x3c, 0x06, 0x02, 0x4e, 0x28, 0x21, 0xf2, 0xa6, 0x69,
0x4b, 0x63, 0x1a, 0xda, 0xaa, 0xad, 0xd4, 0x45, 0xe8, 0x03, 0xa2, 0x8a, 0x82, 0x2c, 0x95, 0x45,
0x37, 0xd6, 0xd8, 0x33, 0xb1, 0x2d, 0x92, 0x99, 0xc8, 0xe3, 0x54, 0x49, 0xa5, 0x76, 0xdf, 0x45,
0xa5, 0xfe, 0x95, 0xfe, 0x87, 0x2e, 0x58, 0xb2, 0xec, 0xaa, 0xaa, 0x60, 0xd3, 0x7f, 0xd0, 0xed,
0x95, 0xc7, 0x8f, 0x24, 0x24, 0x98, 0x84, 0x15, 0x33, 0x67, 0xbe, 0xf3, 0x7d, 0xe7, 0x49, 0x0c,
0x5b, 0xdc, 0x12, 0xd4, 0xff, 0x89, 0xfa, 0x7a, 0x30, 0xa8, 0xf7, 0x7c, 0x1e, 0x70, 0xb4, 0xff,
0x33, 0x0d, 0xb0, 0xed, 0x62, 0x8f, 0xd5, 0xe5, 0x89, 0xfb, 0xb4, 0x9e, 0xa0, 0xca, 0xdb, 0x36,
0xef, 0x76, 0x39, 0xd3, 0xa3, 0x3f, 0x91, 0x47, 0x79, 0xc7, 0xe1, 0x0e, 0x97, 0x47, 0x3d, 0x3c,
0x25, 0xd6, 0x94, 0xda, 0xea, 0xe0, 0x2e, 0x8d, 0xad, 0x87, 0xa9, 0xd5, 0xf6, 0xb9, 0x10, 0x52,
0xc7, 0x6c, 0x77, 0xb0, 0x23, 0x62, 0xc0, 0x5e, 0x0a, 0x48, 0x0e, 0xf1, 0x43, 0x31, 0x7d, 0xe8,
0x61, 0x1f, 0x77, 0x63, 0xbc, 0xf6, 0xa7, 0x02, 0x5b, 0x17, 0xc2, 0x69, 0x12, 0x72, 0xda, 0xe1,
0xf6, 0xcd, 0x39, 0xc5, 0x84, 0xfa, 0x48, 0x85, 0x37, 0xb6, 0x4f, 0x71, 0xc0, 0x7d, 0x55, 0xa9,
0x2a, 0xb5, 0xbc, 0x91, 0x5c, 0x51, 0x09, 0x56, 0x23, 0x51, 0x8f, 0xa8, 0xaf, 0xaa, 0x4a, 0x6d,
0xc9, 0x78, 0x23, 0xef, 0x2d, 0x82, 0x0e, 0x00, 0xac, 0x90, 0xc3, 0x74, 0xb1, 0x70, 0xd5, 0xa5,
0xaa, 0x52, 0x5b, 0x33, 0xf2, 0xd2, 0x72, 0x8e, 0x85, 0x8b, 0x76, 0x61, 0xc5, 0xa5, 0x9e, 0xe3,
0x06, 0xea, 0x6b, 0xe9, 0x17, 0xdf, 0xd0, 0x71, 0x68, 0x0f, 0x55, 0xd5, 0xe5, 0xaa, 0x52, 0x2b,
0x34, 0x50, 0x3d, 0xae, 0x4e, 0x14, 0xcb, 0xd7, 0x38, 0xc0, 0xa7, 0xaf, 0x6f, 0xff, 0x39, 0xcc,
0x19, 0x31, 0x4e, 0xdb, 0x87, 0xd2, 0x54, 0xc8, 0x06, 0x15, 0x3d, 0xce, 0x04, 0xd5, 0x06, 0xb0,
0x7d, 0x21, 0x9c, 0x1f, 0x7a, 0x04, 0x07, 0xf4, 0x2b, 0xee, 0xd3, 0x2b, 0x99, 0x6d, 0x46, 0x46,
0x67, 0x00, 0x76, 0x8a, 0x93, 0x39, 0x15, 0x1a, 0xef, 0xd6, 0x33, 0xba, 0x58, 0x1f, 0xd1, 0x1a,
0x63, 0xae, 0xda, 0x01, 0xec, 0xcf, 0x50, 0x4e, 0x03, 0xfb, 0x4b, 0x81, 0xf5, 0x28, 0xec, 0xcb,
0x98, 0x28, 0x23, 0xa8, 0xf7, 0x60, 0x33, 0x91, 0x33, 0x31, 0x21, 0x3e, 0x15, 0x51, 0x68, 0x79,
0x63, 0x23, 0xb1, 0x37, 0x23, 0x33, 0xfa, 0x02, 0x4a, 0x32, 0xc4, 0x8e, 0x47, 0x59, 0x60, 0x3a,
0x3e, 0x66, 0x01, 0xa5, 0x66, 0xaf, 0x6f, 0xdd, 0xd0, 0xa1, 0xec, 0x42, 0xde, 0xd8, 0x1b, 0x01,
0xce, 0xa2, 0xf7, 0x2b, 0xf9, 0x8c, 0x3e, 0x82, 0x22, 0x26, 0xc4, 0x64, 0x9c, 0x50, 0x13, 0xdb,
0x36, 0xef, 0xb3, 0xc0, 0xe4, 0xac, 0x33, 0x94, 0x2d, 0x5a, 0x35, 0x10, 0x26, 0xe4, 0x7b, 0x4e,
0x68, 0x33, 0x7a, 0xba, 0x64, 0x9d, 0xa1, 0xa6, 0xc2, 0xee, 0x64, 0x16, 0x69, 0x82, 0xbf, 0x29,
0xb0, 0x91, 0xf4, 0x05, 0x77, 0xe9, 0x35, 0x0f, 0xe8, 0xcb, 0x06, 0xa9, 0x19, 0x0e, 0x12, 0xee,
0x52, 0xd3, 0x63, 0x6d, 0x2e, 0x53, 0x28, 0x34, 0xb4, 0xcc, 0x8e, 0x48, 0xc1, 0x70, 0xd8, 0x70,
0x97, 0xb6, 0x58, 0x9b, 0x6b, 0x25, 0xd8, 0x7b, 0x14, 0x4a, 0x1a, 0xe6, 0xff, 0xaf, 0x40, 0x1d,
0xf5, 0x29, 0xdd, 0xa2, 0x6f, 0xc3, 0x25, 0xca, 0x88, 0xf7, 0x7d, 0xd8, 0xf4, 0x44, 0x8b, 0x59,
0xbc, 0xcf, 0xc8, 0x37, 0x0c, 0x5b, 0x1d, 0x4a, 0x64, 0x68, 0xab, 0xc6, 0x94, 0x1d, 0x1d, 0xc1,
0x96, 0x27, 0x2e, 0xfb, 0xc1, 0x04, 0x38, 0x2a, 0xe9, 0xf4, 0x03, 0x72, 0xa1, 0xe8, 0x60, 0x71,
0xe5, 0x7b, 0x36, 0x6d, 0xb1, 0x50, 0x4e, 0x50, 0x19, 0x4c, 0xbc, 0x0f, 0x8d, 0xcc, 0xcc, 0xcf,
0x66, 0x79, 0x1a, 0xb3, 0x09, 0xd1, 0x2f, 0xf0, 0x8e, 0x35, 0x5a, 0x99, 0x6b, 0xea, 0x7b, 0x6d,
0xcf, 0xc6, 0x81, 0xc7, 0xa3, 0xec, 0xd5, 0x15, 0x29, 0xf8, 0xf9, 0x33, 0xa5, 0x7e, 0x9a, 0xc0,
0xc8, 0xa4, 0xd7, 0x34, 0xa8, 0x3e, 0x55, 0xf8, 0xb4, 0x3b, 0x4d, 0x39, 0x43, 0x11, 0xe6, 0x3b,
0x3a, 0x74, 0x28, 0xcb, 0xe8, 0xc9, 0x0e, 0x2c, 0x4b, 0xc1, 0x78, 0x80, 0xa2, 0x4b, 0xdc, 0xfb,
0x71, 0x8a, 0x84, 0xbd, 0xf1, 0xdf, 0x32, 0x2c, 0x5d, 0x08, 0x07, 0x71, 0x28, 0x8c, 0xef, 0xe1,
0x07, 0x99, 0x19, 0x4f, 0x8e, 0x7b, 0xf9, 0x64, 0x01, 0x70, 0x22, 0x8c, 0x7e, 0x85, 0xcd, 0xa9,
0x7f, 0x49, 0xc7, 0xcf, 0x11, 0x3d, 0xf6, 0x28, 0x7f, 0xb6, 0xa8, 0x47, 0xaa, 0xef, 0xc3, 0xda,
0xc4, 0x5e, 0x1e, 0xcd, 0x91, 0x44, 0x8a, 0x2e, 0x7f, 0xbc, 0x08, 0x3a, 0xd5, 0xfc, 0x5d, 0x81,
0xe2, 0xec, 0x2d, 0xfb, 0x64, 0xce, 0x3c, 0x26, 0xdd, 0xca, 0x5f, 0xbe, 0xc8, 0x6d, 0xbc, 0x06,
0x13, 0x73, 0x75, 0x34, 0x1f, 0x5d, 0x84, 0x7e, 0xbe, 0x06, 0xb3, 0x06, 0x0e, 0x0d, 0x60, 0xfd,
0xd1, 0x4f, 0x6b, 0x7d, 0xae, 0x5a, 0xa6, 0xf8, 0xf2, 0xa7, 0x8b, 0xe1, 0x13, 0xe5, 0xd3, 0xd6,
0xed, 0x7d, 0x45, 0xb9, 0xbb, 0xaf, 0x28, 0xff, 0xde, 0x57, 0x94, 0x3f, 0x1e, 0x2a, 0xb9, 0xbb,
0x87, 0x4a, 0xee, 0xef, 0x87, 0x4a, 0xee, 0x47, 0xdd, 0xf1, 0x02, 0xb7, 0x6f, 0x85, 0x3f, 0xb3,
0x7a, 0xc8, 0xf8, 0xa1, 0x24, 0xd7, 0x13, 0x72, 0x7d, 0xa0, 0x8f, 0xbe, 0x6a, 0x86, 0x3d, 0x2a,
0xac, 0x15, 0xf9, 0xa9, 0x70, 0xf2, 0x36, 0x00, 0x00, 0xff, 0xff, 0x46, 0x18, 0xe1, 0x9b, 0xee,
0x08, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MsgClient interface {
AddObserver(ctx context.Context, in *MsgAddObserver, opts ...grpc.CallOption) (*MsgAddObserverResponse, error)
UpdateCoreParams(ctx context.Context, in *MsgUpdateCoreParams, opts ...grpc.CallOption) (*MsgUpdateCoreParamsResponse, error)
AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error)
UpdateCrosschainFlags(ctx context.Context, in *MsgUpdateCrosschainFlags, opts ...grpc.CallOption) (*MsgUpdateCrosschainFlagsResponse, error)
UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error)
AddBlockHeader(ctx context.Context, in *MsgAddBlockHeader, opts ...grpc.CallOption) (*MsgAddBlockHeaderResponse, error)
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) AddObserver(ctx context.Context, in *MsgAddObserver, opts ...grpc.CallOption) (*MsgAddObserverResponse, error) {
out := new(MsgAddObserverResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/AddObserver", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateCoreParams(ctx context.Context, in *MsgUpdateCoreParams, opts ...grpc.CallOption) (*MsgUpdateCoreParamsResponse, error) {
out := new(MsgUpdateCoreParamsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateCoreParams", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error) {
out := new(MsgAddBlameVoteResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/AddBlameVote", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateCrosschainFlags(ctx context.Context, in *MsgUpdateCrosschainFlags, opts ...grpc.CallOption) (*MsgUpdateCrosschainFlagsResponse, error) {
out := new(MsgUpdateCrosschainFlagsResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateCrosschainFlags", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error) {
out := new(MsgUpdateKeygenResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateKeygen", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) AddBlockHeader(ctx context.Context, in *MsgAddBlockHeader, opts ...grpc.CallOption) (*MsgAddBlockHeaderResponse, error) {
out := new(MsgAddBlockHeaderResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/AddBlockHeader", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
AddObserver(context.Context, *MsgAddObserver) (*MsgAddObserverResponse, error)
UpdateCoreParams(context.Context, *MsgUpdateCoreParams) (*MsgUpdateCoreParamsResponse, error)
AddBlameVote(context.Context, *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error)
UpdateCrosschainFlags(context.Context, *MsgUpdateCrosschainFlags) (*MsgUpdateCrosschainFlagsResponse, error)
UpdateKeygen(context.Context, *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error)
AddBlockHeader(context.Context, *MsgAddBlockHeader) (*MsgAddBlockHeaderResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) AddObserver(ctx context.Context, req *MsgAddObserver) (*MsgAddObserverResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddObserver not implemented")
}
func (*UnimplementedMsgServer) UpdateCoreParams(ctx context.Context, req *MsgUpdateCoreParams) (*MsgUpdateCoreParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateCoreParams not implemented")
}
func (*UnimplementedMsgServer) AddBlameVote(ctx context.Context, req *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddBlameVote not implemented")
}
func (*UnimplementedMsgServer) UpdateCrosschainFlags(ctx context.Context, req *MsgUpdateCrosschainFlags) (*MsgUpdateCrosschainFlagsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateCrosschainFlags not implemented")
}
func (*UnimplementedMsgServer) UpdateKeygen(ctx context.Context, req *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateKeygen not implemented")
}
func (*UnimplementedMsgServer) AddBlockHeader(ctx context.Context, req *MsgAddBlockHeader) (*MsgAddBlockHeaderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddBlockHeader not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
func _Msg_AddObserver_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAddObserver)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AddObserver(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Msg/AddObserver",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AddObserver(ctx, req.(*MsgAddObserver))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateCoreParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateCoreParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateCoreParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Msg/UpdateCoreParams",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateCoreParams(ctx, req.(*MsgUpdateCoreParams))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_AddBlameVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAddBlameVote)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AddBlameVote(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Msg/AddBlameVote",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AddBlameVote(ctx, req.(*MsgAddBlameVote))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateCrosschainFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateCrosschainFlags)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateCrosschainFlags(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Msg/UpdateCrosschainFlags",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateCrosschainFlags(ctx, req.(*MsgUpdateCrosschainFlags))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateKeygen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateKeygen)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateKeygen(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Msg/UpdateKeygen",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateKeygen(ctx, req.(*MsgUpdateKeygen))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_AddBlockHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAddBlockHeader)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AddBlockHeader(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/zetachain.zetacore.observer.Msg/AddBlockHeader",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AddBlockHeader(ctx, req.(*MsgAddBlockHeader))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.observer.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddObserver",
Handler: _Msg_AddObserver_Handler,
},
{
MethodName: "UpdateCoreParams",
Handler: _Msg_UpdateCoreParams_Handler,
},
{
MethodName: "AddBlameVote",
Handler: _Msg_AddBlameVote_Handler,
},
{
MethodName: "UpdateCrosschainFlags",
Handler: _Msg_UpdateCrosschainFlags_Handler,
},
{
MethodName: "UpdateKeygen",
Handler: _Msg_UpdateKeygen_Handler,
},
{
MethodName: "AddBlockHeader",
Handler: _Msg_AddBlockHeader_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "observer/tx.proto",
}
func (m *MsgAddBlockHeader) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddBlockHeader) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddBlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
if m.Height != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x20
}
if len(m.BlockHash) > 0 {
i -= len(m.BlockHash)
copy(dAtA[i:], m.BlockHash)
i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash)))
i--
dAtA[i] = 0x1a
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgAddBlockHeaderResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgUpdateCoreParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateCoreParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateCoreParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.CoreParams != nil {
{
size, err := m.CoreParams.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateCoreParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateCoreParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateCoreParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgAddObserver) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddObserver) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddObserver) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.AddNodeAccountOnly {
i--
if m.AddNodeAccountOnly {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
if len(m.ZetaclientGranteePubkey) > 0 {
i -= len(m.ZetaclientGranteePubkey)
copy(dAtA[i:], m.ZetaclientGranteePubkey)
i = encodeVarintTx(dAtA, i, uint64(len(m.ZetaclientGranteePubkey)))
i--
dAtA[i] = 0x1a
}
if len(m.ObserverAddress) > 0 {
i -= len(m.ObserverAddress)
copy(dAtA[i:], m.ObserverAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.ObserverAddress)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgAddObserverResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddObserverResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddObserverResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgAddBlameVote) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddBlameVote) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddBlameVote) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlameInfo != nil {
{
size, err := m.BlameInfo.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if m.ChainId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgAddBlameVoteResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAddBlameVoteResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAddBlameVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgUpdateCrosschainFlags) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateCrosschainFlags) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateCrosschainFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockHeaderVerificationFlags != nil {
{
size, err := m.BlockHeaderVerificationFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
if m.GasPriceIncreaseFlags != nil {
{
size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
if m.IsOutboundEnabled {
i--
if m.IsOutboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
if m.IsInboundEnabled {
i--
if m.IsInboundEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateCrosschainFlagsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateCrosschainFlagsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateCrosschainFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgUpdateKeygen) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateKeygen) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateKeygen) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Block != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Block))
i--
dAtA[i] = 0x10
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateKeygenResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateKeygenResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateKeygenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *MsgAddBlockHeader) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
l = len(m.BlockHash)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.Height != 0 {
n += 1 + sovTx(uint64(m.Height))
}
l = m.Header.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgAddBlockHeaderResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgUpdateCoreParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.CoreParams != nil {
l = m.CoreParams.Size()
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateCoreParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgAddObserver) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.ObserverAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.ZetaclientGranteePubkey)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.AddNodeAccountOnly {
n += 2
}
return n
}
func (m *MsgAddObserverResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgAddBlameVote) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ChainId != 0 {
n += 1 + sovTx(uint64(m.ChainId))
}
if m.BlameInfo != nil {
l = m.BlameInfo.Size()
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgAddBlameVoteResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgUpdateCrosschainFlags) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.IsInboundEnabled {
n += 2
}
if m.IsOutboundEnabled {
n += 2
}
if m.GasPriceIncreaseFlags != nil {
l = m.GasPriceIncreaseFlags.Size()
n += 1 + l + sovTx(uint64(l))
}
if m.BlockHeaderVerificationFlags != nil {
l = m.BlockHeaderVerificationFlags.Size()
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateCrosschainFlagsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgUpdateKeygen) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.Block != 0 {
n += 1 + sovTx(uint64(m.Block))
}
return n
}
func (m *MsgUpdateKeygenResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgAddBlockHeader) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddBlockHeader: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddBlockHeader: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...)
if m.BlockHash == nil {
m.BlockHash = []byte{}
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddBlockHeaderResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddBlockHeaderResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateCoreParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateCoreParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateCoreParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.CoreParams == nil {
m.CoreParams = &CoreParams{}
}
if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateCoreParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateCoreParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateCoreParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddObserver) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddObserver: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddObserver: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObserverAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ObserverAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ZetaclientGranteePubkey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ZetaclientGranteePubkey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field AddNodeAccountOnly", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.AddNodeAccountOnly = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddObserverResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddObserverResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddObserverResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddBlameVote: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddBlameVote: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
m.ChainId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BlameInfo == nil {
m.BlameInfo = &Blame{}
}
if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAddBlameVoteResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAddBlameVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateCrosschainFlags: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateCrosschainFlags: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsInboundEnabled = bool(v != 0)
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.IsOutboundEnabled = bool(v != 0)
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.GasPriceIncreaseFlags == nil {
m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{}
}
if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeaderVerificationFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BlockHeaderVerificationFlags == nil {
m.BlockHeaderVerificationFlags = &BlockHeaderVerificationFlags{}
}
if err := m.BlockHeaderVerificationFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateCrosschainFlagsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateCrosschainFlagsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateCrosschainFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateKeygen) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateKeygen: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateKeygen: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType)
}
m.Block = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Block |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateKeygenResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateKeygenResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
package types
import "gitlab.com/thorchain/tss/go-tss/blame"
func ConvertNodes(n []blame.Node) (nodes []*Node) {
for _, node := range n {
var entry Node
entry.PubKey = node.Pubkey
entry.BlameSignature = node.BlameSignature
entry.BlameData = node.BlameData
nodes = append(nodes, &entry)
}
return
}
package zetaclient
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
)
type AuthZSigner struct {
KeyType common.KeyType
GranterAddress string
GranteeAddress sdk.AccAddress
}
func (a AuthZSigner) String() string {
return a.KeyType.String() + " " + a.GranterAddress + " " + a.GranteeAddress.String()
}
var signers map[string]AuthZSigner
func init() {
signersList := make(map[string]AuthZSigner)
for _, tx := range crosschaintypes.GetAllAuthzZetaclientTxTypes() {
signersList[tx] = AuthZSigner{KeyType: common.ZetaClientGranteeKey}
}
signers = signersList
}
func SetupAuthZSignerList(granter string, grantee sdk.AccAddress) {
for k, v := range signers {
v.GranterAddress = granter
v.GranteeAddress = grantee
signers[k] = v
}
}
func GetSigner(msgURL string) AuthZSigner {
return signers[msgURL]
}
package zetaclient
import (
"bytes"
"encoding/hex"
"fmt"
"math"
"math/big"
"os"
"sort"
"strconv"
"sync"
"sync/atomic"
cosmosmath "cosmossdk.io/math"
"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/rpcclient"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
lru "github.com/hashicorp/golang-lru"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
metricsPkg "github.com/zeta-chain/zetacore/zetaclient/metrics"
clienttypes "github.com/zeta-chain/zetacore/zetaclient/types"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
var _ ChainClient = &BitcoinChainClient{}
type BTCLog struct {
ChainLogger zerolog.Logger
WatchInTx zerolog.Logger
ObserveOutTx zerolog.Logger
WatchUTXOS zerolog.Logger
WatchGasPrice zerolog.Logger
}
// BitcoinChainClient represents a chain configuration for Bitcoin
// Filled with above constants depending on chain
type BitcoinChainClient struct {
*ChainMetrics
chain common.Chain
rpcClient BTCRPCClient
zetaClient ZetaCoreBridger
Tss TSSSigner
lastBlock int64
lastBlockScanned int64
BlockTime uint64 // block time in seconds
Mu *sync.Mutex // lock for all the maps, utxos and core params
pendingNonce uint64
includedTxHashes map[string]uint64 // key: tx hash
includedTxResults map[string]btcjson.GetTransactionResult // key: chain-tss-nonce
broadcastedTx map[string]string // key: chain-tss-nonce, value: outTx hash
utxos []btcjson.ListUnspentResult
params observertypes.CoreParams
db *gorm.DB
stop chan struct{}
logger BTCLog
ts *TelemetryServer
BlockCache *lru.Cache
}
const (
minConfirmations = 0
maxHeightDiff = 10000
btcBlocksPerDay = 144
bytesPerKB = 1000
)
func (ob *BitcoinChainClient) WithZetaClient(bridge *ZetaCoreBridge) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.zetaClient = bridge
}
func (ob *BitcoinChainClient) WithLogger(logger zerolog.Logger) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.logger = BTCLog{
ChainLogger: logger,
WatchInTx: logger.With().Str("module", "WatchInTx").Logger(),
ObserveOutTx: logger.With().Str("module", "observeOutTx").Logger(),
WatchUTXOS: logger.With().Str("module", "WatchUTXOS").Logger(),
WatchGasPrice: logger.With().Str("module", "WatchGasPrice").Logger(),
}
}
func (ob *BitcoinChainClient) WithBtcClient(client *rpcclient.Client) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.rpcClient = client
}
func (ob *BitcoinChainClient) WithChain(chain common.Chain) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.chain = chain
}
func (ob *BitcoinChainClient) SetCoreParams(params observertypes.CoreParams) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.params = params
}
func (ob *BitcoinChainClient) GetCoreParams() observertypes.CoreParams {
ob.Mu.Lock()
defer ob.Mu.Unlock()
return ob.params
}
// NewBitcoinClient returns a new configuration based on supplied target chain
func NewBitcoinClient(
chain common.Chain,
bridge ZetaCoreBridger,
tss TSSSigner,
dbpath string,
metrics *metricsPkg.Metrics,
logger zerolog.Logger,
btcCfg config.BTCConfig,
ts *TelemetryServer,
) (*BitcoinChainClient, error) {
ob := BitcoinChainClient{
ChainMetrics: NewChainMetrics(chain.ChainName.String(), metrics),
ts: ts,
}
ob.stop = make(chan struct{})
ob.chain = chain
ob.Mu = &sync.Mutex{}
chainLogger := logger.With().Str("chain", chain.ChainName.String()).Logger()
ob.logger = BTCLog{
ChainLogger: chainLogger,
WatchInTx: chainLogger.With().Str("module", "WatchInTx").Logger(),
ObserveOutTx: chainLogger.With().Str("module", "observeOutTx").Logger(),
WatchUTXOS: chainLogger.With().Str("module", "WatchUTXOS").Logger(),
WatchGasPrice: chainLogger.With().Str("module", "WatchGasPrice").Logger(),
}
ob.zetaClient = bridge
ob.Tss = tss
ob.includedTxHashes = make(map[string]uint64)
ob.includedTxResults = make(map[string]btcjson.GetTransactionResult)
ob.broadcastedTx = make(map[string]string)
ob.params = btcCfg.CoreParams
// initialize the Client
ob.logger.ChainLogger.Info().Msgf("Chain %s endpoint %s", ob.chain.String(), btcCfg.RPCHost)
connCfg := &rpcclient.ConnConfig{
Host: btcCfg.RPCHost,
User: btcCfg.RPCUsername,
Pass: btcCfg.RPCPassword,
HTTPPostMode: true,
DisableTLS: true,
Params: btcCfg.RPCParams,
}
client, err := rpcclient.New(connCfg, nil)
if err != nil {
return nil, fmt.Errorf("error creating rpc client: %s", err)
}
ob.rpcClient = client
err = client.Ping()
if err != nil {
return nil, fmt.Errorf("error ping the bitcoin server: %s", err)
}
ob.BlockCache, err = lru.New(btcBlocksPerDay)
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("failed to create bitcoin block cache")
return nil, err
}
err = ob.RegisterPromGauge(metricsPkg.PendingTxs, "Number of pending transactions")
if err != nil {
return nil, err
}
//Load btc chain client DB
err = ob.loadDB(dbpath)
if err != nil {
return nil, err
}
return &ob, nil
}
func (ob *BitcoinChainClient) Start() {
ob.logger.ChainLogger.Info().Msgf("BitcoinChainClient is starting")
go ob.WatchInTx()
go ob.observeOutTx()
go ob.WatchUTXOS()
go ob.WatchGasPrice()
go ob.ExternalChainWatcherForNewInboundTrackerSuggestions()
}
func (ob *BitcoinChainClient) Stop() {
ob.logger.ChainLogger.Info().Msgf("ob %s is stopping", ob.chain.String())
close(ob.stop) // this notifies all goroutines to stop
ob.logger.ChainLogger.Info().Msgf("%s observer stopped", ob.chain.String())
}
func (ob *BitcoinChainClient) SetLastBlockHeight(block int64) {
if block < 0 {
panic("lastBlock is negative")
}
if block >= math.MaxInt64 {
panic("lastBlock is too large")
}
atomic.StoreInt64(&ob.lastBlock, block)
}
func (ob *BitcoinChainClient) GetLastBlockHeight() int64 {
height := atomic.LoadInt64(&ob.lastBlock)
if height < 0 {
panic("lastBlock is negative")
}
if height >= math.MaxInt64 {
panic("lastBlock is too large")
}
return height
}
func (ob *BitcoinChainClient) SetLastBlockHeightScanned(block int64) {
if block < 0 {
panic("lastBlockScanned is negative")
}
if block >= math.MaxInt64 {
panic("lastBlockScanned is too large")
}
atomic.StoreInt64(&ob.lastBlockScanned, block)
ob.ts.SetLastScannedBlockNumber((ob.chain.ChainId), (block))
}
func (ob *BitcoinChainClient) GetLastBlockHeightScanned() int64 {
height := atomic.LoadInt64(&ob.lastBlockScanned)
if height < 0 {
panic("lastBlockScanned is negative")
}
if height >= math.MaxInt64 {
panic("lastBlockScanned is too large")
}
return height
}
func (ob *BitcoinChainClient) GetPendingNonce() uint64 {
ob.Mu.Lock()
defer ob.Mu.Unlock()
return ob.pendingNonce
}
// GetBaseGasPrice ...
// TODO: implement
// https://github.com/zeta-chain/node/issues/868
func (ob *BitcoinChainClient) GetBaseGasPrice() *big.Int {
return big.NewInt(0)
}
func (ob *BitcoinChainClient) WatchInTx() {
ticker := NewDynamicTicker("Bitcoin_WatchInTx", ob.GetCoreParams().InTxTicker)
defer ticker.Stop()
for {
select {
case <-ticker.C():
err := ob.observeInTx()
if err != nil {
ob.logger.WatchInTx.Error().Err(err).Msg("error observing in tx")
}
ticker.UpdateInterval(ob.GetCoreParams().InTxTicker, ob.logger.WatchInTx)
case <-ob.stop:
ob.logger.WatchInTx.Info().Msg("WatchInTx stopped")
return
}
}
}
// TODO
func (ob *BitcoinChainClient) observeInTx() error {
cnt, err := ob.rpcClient.GetBlockCount()
if err != nil {
return fmt.Errorf("error getting block count: %s", err)
}
if cnt < 0 || cnt >= math.MaxInt64 {
return fmt.Errorf("block count is out of range: %d", cnt)
}
// "confirmed" current block number
// #nosec G701 always in range
confirmedBlockNum := cnt - int64(ob.GetCoreParams().ConfirmationCount)
if confirmedBlockNum < 0 || confirmedBlockNum > math.MaxInt64 {
return fmt.Errorf("skipping observer , confirmedBlockNum is negative or too large ")
}
ob.SetLastBlockHeight(confirmedBlockNum)
flags, err := ob.zetaClient.GetCrosschainFlags()
if err != nil {
return err
}
if !flags.IsInboundEnabled {
return errors.New("inbound TXS / Send has been disabled by the protocol")
}
lastBN := ob.GetLastBlockHeightScanned()
// query incoming gas asset
if confirmedBlockNum > lastBN {
bn := lastBN + 1
res, err := ob.GetBlockByNumberCached(bn)
if err != nil {
ob.logger.WatchInTx.Error().Err(err).Msgf("error getting bitcoin block %d", bn)
return err
}
ob.logger.WatchInTx.Info().Msgf("block %d has %d txs, current block %d, last block %d", bn, len(res.Block.Tx), cnt, lastBN)
// print some debug information
if len(res.Block.Tx) > 1 {
for idx, tx := range res.Block.Tx {
ob.logger.WatchInTx.Debug().Msgf("BTC InTX | %d: %s\n", idx, tx.Txid)
for vidx, vout := range tx.Vout {
ob.logger.WatchInTx.Debug().Msgf("vout %d \n value: %v\n scriptPubKey: %v\n", vidx, vout.Value, vout.ScriptPubKey.Hex)
}
}
}
// add block header to zetacore
var headerBuf bytes.Buffer
err = res.Header.Serialize(&headerBuf)
if err != nil { // should never happen
ob.logger.WatchInTx.Error().Err(err).Msgf("error serializing bitcoin block header: %d", bn)
return err
}
blockHash := res.Header.BlockHash()
_, err = ob.zetaClient.PostAddBlockHeader(
ob.chain.ChainId,
blockHash[:],
res.Block.Height,
common.NewBitcoinHeader(headerBuf.Bytes()),
)
if err != nil { // error shouldn't block the process
ob.logger.WatchInTx.Error().Err(err).Msgf("error posting bitcoin block header: %d", bn)
}
tssAddress := ob.Tss.BTCAddress()
// #nosec G701 always positive
inTxs := FilterAndParseIncomingTx(res.Block.Tx, uint64(res.Block.Height), tssAddress, &ob.logger.WatchInTx)
for _, inTx := range inTxs {
msg := ob.GetInboundVoteMessageFromBtcEvent(inTx)
zetaHash, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, msg)
if err != nil {
ob.logger.WatchInTx.Error().Err(err).Msg("error posting to zeta core")
continue
}
ob.logger.WatchInTx.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
}
// Save LastBlockHeight
ob.SetLastBlockHeightScanned(bn)
if err := ob.db.Save(clienttypes.ToLastBlockSQLType(ob.GetLastBlockHeightScanned())).Error; err != nil {
ob.logger.WatchInTx.Error().Err(err).Msg("error writing Block to db")
}
}
return nil
}
// ConfirmationsThreshold returns number of required Bitcoin confirmations depending on sent BTC amount.
func (ob *BitcoinChainClient) ConfirmationsThreshold(amount *big.Int) int64 {
if amount.Cmp(big.NewInt(200000000)) >= 0 {
return 6
}
return 2
}
// IsSendOutTxProcessed returns isIncluded(or inMempool), isConfirmed, Error
func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, _ common.CoinType, logger zerolog.Logger) (bool, bool, error) {
outTxID := ob.GetTxID(nonce)
logger.Info().Msgf("IsSendOutTxProcessed %s", outTxID)
ob.Mu.Lock()
txnHash, broadcasted := ob.broadcastedTx[outTxID]
res, included := ob.includedTxResults[outTxID]
ob.Mu.Unlock()
// Get original cctx parameters
params, err := ob.GetPendingCctxParams(nonce)
if err != nil {
ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: can't find pending cctx for nonce %d", nonce)
return false, false, err
}
// Get original cctx parameters
params, err = ob.GetPendingCctxParams(nonce)
if err != nil {
ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: can't find pending cctx for nonce %d", nonce)
return false, false, err
}
// Get original cctx parameters
params, err = ob.GetPendingCctxParams(nonce)
if err != nil {
ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: can't find pending cctx for nonce %d", nonce)
return false, false, err
}
if !included {
if !broadcasted {
return false, false, nil
}
// If the broadcasted outTx is nonce 0, just wait for inclusion and don't schedule more keysign
// Schedule more than one keysign for nonce 0 can lead to duplicate payments.
// One purpose of nonce mark UTXO is to avoid duplicate payment based on the fact that Bitcoin
// prevents double spending of same UTXO. However, for nonce 0, we don't have a prior nonce (e.g., -1)
// for the signer to check against when making the payment. Signer treats nonce 0 as a special case in downstream code.
if nonce == 0 {
return true, false, nil
}
// Try including this outTx broadcasted by myself
inMempool, err := ob.checkNSaveIncludedTx(txnHash, params)
if err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msg("IsSendOutTxProcessed: checkNSaveIncludedTx failed")
return false, false, err
}
if inMempool { // to avoid unnecessary Tss keysign
ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: outTx %s is still in mempool", outTxID)
return true, false, nil
}
// Get tx result again in case it is just included
ob.Mu.Lock()
res, included = ob.includedTxResults[outTxID]
ob.Mu.Unlock()
if !included {
return false, false, nil
}
ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: checkNSaveIncludedTx succeeded for outTx %s", outTxID)
}
// It's safe to use cctx's amount to post confirmation because it has already been verified in observeOutTx()
amountInSat := params.Amount.BigInt()
if res.Confirmations < ob.ConfirmationsThreshold(amountInSat) {
return true, false, nil
}
logger.Debug().Msgf("Bitcoin outTx confirmed: txid %s, amount %s\n", res.TxID, amountInSat.String())
zetaHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
res.TxID,
// #nosec G701 always positive
uint64(res.BlockIndex),
0, // gas used not used with Bitcoin
nil, // gas price not used with Bitcoin
0, // gas limit not used with Bitcoin
amountInSat,
common.ReceiveStatus_Success,
ob.chain,
nonce,
common.CoinType_Gas,
)
if err != nil {
logger.Error().Err(err).Msgf("error posting to zeta core")
} else {
logger.Info().Msgf("Bitcoin outTx %s confirmed: PostReceiveConfirmation zeta tx: %s", res.TxID, zetaHash)
}
return true, true, nil
}
func (ob *BitcoinChainClient) WatchGasPrice() {
ticker := NewDynamicTicker("Bitcoin_WatchGasPrice", ob.GetCoreParams().GasPriceTicker)
defer ticker.Stop()
for {
select {
case <-ticker.C():
err := ob.PostGasPrice()
if err != nil {
ob.logger.WatchGasPrice.Error().Err(err).Msg("PostGasPrice error on " + ob.chain.String())
}
ticker.UpdateInterval(ob.GetCoreParams().GasPriceTicker, ob.logger.WatchGasPrice)
case <-ob.stop:
ob.logger.WatchGasPrice.Info().Msg("WatchGasPrice stopped")
return
}
}
}
func (ob *BitcoinChainClient) PostGasPrice() error {
if ob.chain.ChainId == 18444 { //bitcoin regtest; hardcode here since this RPC is not available on regtest
bn, err := ob.rpcClient.GetBlockCount()
if err != nil {
return err
}
// #nosec G701 always in range
zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, 1, "100", uint64(bn))
if err != nil {
ob.logger.WatchGasPrice.Err(err).Msg("PostGasPrice:")
return err
}
_ = zetaHash
//ob.logger.WatchGasPrice.Debug().Msgf("PostGasPrice zeta tx: %s", zetaHash)
return nil
}
// EstimateSmartFee returns the fees per kilobyte (BTC/kb) targeting given block confirmation
feeResult, err := ob.rpcClient.EstimateSmartFee(1, &btcjson.EstimateModeConservative)
if err != nil {
return err
}
if feeResult.Errors != nil || feeResult.FeeRate == nil {
return fmt.Errorf("error getting gas price: %s", feeResult.Errors)
}
if *feeResult.FeeRate > math.MaxInt64 {
return fmt.Errorf("gas price is too large: %f", *feeResult.FeeRate)
}
// #nosec G701 always in range
feeRate := new(big.Int).SetInt64(int64(*feeResult.FeeRate * 1e8))
feeRatePerByte := new(big.Int).Div(feeRate, big.NewInt(bytesPerKB))
bn, err := ob.rpcClient.GetBlockCount()
if err != nil {
return err
}
// #nosec G701 always positive
zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, feeRatePerByte.Uint64(), "100", uint64(bn))
if err != nil {
ob.logger.WatchGasPrice.Err(err).Msg("PostGasPrice:")
return err
}
_ = zetaHash
return nil
}
type BTCInTxEvnet struct {
FromAddress string // the first input address
ToAddress string // some TSS address
Value float64 // in BTC, not satoshi
MemoBytes []byte
BlockNumber uint64
TxHash string
}
// FilterAndParseIncomingTx given txs list returned by the "getblock 2" RPC command, return the txs that are relevant to us
// relevant tx must have the following vouts as the first two vouts:
// vout0: p2wpkh to the TSS address (targetAddress)
// vout1: OP_RETURN memo, base64 encoded
func FilterAndParseIncomingTx(txs []btcjson.TxRawResult, blockNumber uint64, targetAddress string, logger *zerolog.Logger) []*BTCInTxEvnet {
inTxs := make([]*BTCInTxEvnet, 0)
for idx, tx := range txs {
if idx == 0 {
continue // the first tx is coinbase; we do not process coinbase tx
}
inTx, err := GetBtcEvent(tx, targetAddress, blockNumber, logger)
if err != nil {
logger.Error().Err(err).Msg("error getting btc event")
continue
}
if inTx != nil {
inTxs = append(inTxs, inTx)
}
}
return inTxs
}
func (ob *BitcoinChainClient) GetInboundVoteMessageFromBtcEvent(inTx *BTCInTxEvnet) *types.MsgVoteOnObservedInboundTx {
ob.logger.WatchInTx.Debug().Msgf("Processing inTx: %s", inTx.TxHash)
amount := big.NewFloat(inTx.Value)
amount = amount.Mul(amount, big.NewFloat(1e8))
amountInt, _ := amount.Int(nil)
message := hex.EncodeToString(inTx.MemoBytes)
return GetInBoundVoteMessage(
inTx.FromAddress,
ob.chain.ChainId,
inTx.FromAddress,
inTx.FromAddress,
common.ZetaChain().ChainId,
cosmosmath.NewUintFromBigInt(amountInt),
message,
inTx.TxHash,
inTx.BlockNumber,
0,
common.CoinType_Gas,
"",
ob.zetaClient.GetKeys().GetOperatorAddress().String(),
)
}
func GetBtcEvent(tx btcjson.TxRawResult, targetAddress string, blockNumber uint64, logger *zerolog.Logger) (*BTCInTxEvnet, error) {
found := false
var value float64
var memo []byte
if len(tx.Vout) >= 2 {
// first vout must to addressed to the targetAddress with p2wpkh scriptPubKey
out := tx.Vout[0]
script := out.ScriptPubKey.Hex
if len(script) == 44 && script[:4] == "0014" { // segwit output: 0x00 + 20 bytes of pubkey hash
hash, err := hex.DecodeString(script[4:])
if err != nil {
return nil, err
}
wpkhAddress, err := btcutil.NewAddressWitnessPubKeyHash(hash, config.BitconNetParams)
if err != nil {
return nil, err
}
if wpkhAddress.EncodeAddress() != targetAddress {
return nil, err
}
value = out.Value
out = tx.Vout[1]
script = out.ScriptPubKey.Hex
if len(script) >= 4 && script[:2] == "6a" { // OP_RETURN
memoSize, err := strconv.ParseInt(script[2:4], 16, 32)
if err != nil {
return nil, errors.Wrapf(err, "error decoding pubkey hash")
}
if int(memoSize) != (len(script)-4)/2 {
return nil, fmt.Errorf("memo size mismatch: %d != %d", memoSize, (len(script)-4)/2)
}
memoBytes, err := hex.DecodeString(script[4:])
if err != nil {
logger.Warn().Err(err).Msgf("error hex decoding memo")
return nil, fmt.Errorf("error hex decoding memo: %s", err)
}
if bytes.Compare(memoBytes, []byte(DonationMessage)) == 0 {
logger.Info().Msgf("donation tx: %s; value %f", tx.Txid, value)
return nil, fmt.Errorf("donation tx: %s; value %f", tx.Txid, value)
}
memo = memoBytes
found = true
}
}
}
if found {
fmt.Println("found tx: ", tx.Txid)
var fromAddress string
if len(tx.Vin) > 0 {
vin := tx.Vin[0]
//log.Info().Msgf("vin: %v", vin.Witness)
if len(vin.Witness) == 2 {
pk := vin.Witness[1]
pkBytes, err := hex.DecodeString(pk)
if err != nil {
return nil, errors.Wrapf(err, "error decoding pubkey")
}
hash := btcutil.Hash160(pkBytes)
addr, err := btcutil.NewAddressWitnessPubKeyHash(hash, config.BitconNetParams)
if err != nil {
return nil, errors.Wrapf(err, "error decoding pubkey hash")
}
fromAddress = addr.EncodeAddress()
}
}
return &BTCInTxEvnet{
FromAddress: fromAddress,
ToAddress: targetAddress,
Value: value,
MemoBytes: memo,
BlockNumber: blockNumber,
TxHash: tx.Txid,
}, nil
}
return nil, nil
}
func (ob *BitcoinChainClient) WatchUTXOS() {
ticker := NewDynamicTicker("Bitcoin_WatchUTXOS", ob.GetCoreParams().WatchUtxoTicker)
defer ticker.Stop()
for {
select {
case <-ticker.C():
err := ob.FetchUTXOS()
if err != nil {
ob.logger.WatchUTXOS.Error().Err(err).Msg("error fetching btc utxos")
}
ticker.UpdateInterval(ob.GetCoreParams().WatchUtxoTicker, ob.logger.WatchUTXOS)
case <-ob.stop:
ob.logger.WatchUTXOS.Info().Msg("WatchUTXOS stopped")
return
}
}
}
func (ob *BitcoinChainClient) FetchUTXOS() error {
defer func() {
if err := recover(); err != nil {
ob.logger.WatchUTXOS.Error().Msgf("BTC fetchUTXOS: caught panic error: %v", err)
}
}()
// This is useful when a zetaclient's pending nonce lagged behind for whatever reason.
ob.refreshPendingNonce()
// get the current block height.
bh, err := ob.rpcClient.GetBlockCount()
if err != nil {
return fmt.Errorf("btc: error getting block height : %v", err)
}
maxConfirmations := int(bh)
// List unspent.
tssAddr := ob.Tss.BTCAddress()
address, err := btcutil.DecodeAddress(tssAddr, config.BitconNetParams)
if err != nil {
return fmt.Errorf("btc: error decoding wallet address (%s) : %s", tssAddr, err.Error())
}
addresses := []btcutil.Address{address}
// fetching all TSS utxos takes 160ms
utxos, err := ob.rpcClient.ListUnspentMinMaxAddresses(0, maxConfirmations, addresses)
if err != nil {
return err
}
//ob.logger.WatchUTXOS.Debug().Msgf("btc: fetched %d utxos in confirmation range [0, %d]", len(unspents), maxConfirmations)
// rigid sort to make utxo list deterministic
sort.SliceStable(utxos, func(i, j int) bool {
if utxos[i].Amount == utxos[j].Amount {
if utxos[i].TxID == utxos[j].TxID {
return utxos[i].Vout < utxos[j].Vout
}
return utxos[i].TxID < utxos[j].TxID
}
return utxos[i].Amount < utxos[j].Amount
})
ob.Mu.Lock()
ob.ts.SetNumberOfUTXOs(len(utxos))
ob.utxos = utxos
ob.Mu.Unlock()
return nil
}
// refreshPendingNonce tries increasing the artificial pending nonce of outTx (if lagged behind).
// There could be many (unpredictable) reasons for a pending nonce lagging behind, for example:
// 1. The zetaclient gets restarted.
// 2. The tracker is missing in zetacore.
func (ob *BitcoinChainClient) refreshPendingNonce() {
// get pending nonces from zetacore
p, err := ob.zetaClient.GetPendingNoncesByChain(ob.chain.ChainId)
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("refreshPendingNonce: error getting pending nonces")
}
// increase pending nonce if lagged behind
ob.Mu.Lock()
pendingNonce := ob.pendingNonce
ob.Mu.Unlock()
// #nosec G701 always non-negative
nonceLow := uint64(p.NonceLow)
if nonceLow > pendingNonce {
// get the last included outTx hash
txid, err := ob.getOutTxidByNonce(nonceLow-1, false)
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("refreshPendingNonce: error getting last outTx txid")
}
// set 'NonceLow' as the new pending nonce
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.pendingNonce = nonceLow
ob.logger.ChainLogger.Info().Msgf("refreshPendingNonce: increase pending nonce to %d with txid %s", ob.pendingNonce, txid)
}
}
func (ob *BitcoinChainClient) getOutTxidByNonce(nonce uint64, test bool) (string, error) {
ob.Mu.Lock()
res, included := ob.includedTxResults[ob.GetTxID(nonce)]
ob.Mu.Unlock()
// There are 2 types of txids an observer can trust
// 1. The ones had been verified and saved by observer self.
// 2. The ones had been finalized in zetacore based on majority vote.
if included {
return res.TxID, nil
}
if !test { // if not unit test, get cctx from zetacore
send, err := ob.zetaClient.GetCctxByNonce(ob.chain.ChainId, nonce)
if err != nil {
return "", errors.Wrapf(err, "getOutTxidByNonce: error getting cctx for nonce %d", nonce)
}
txid := send.GetCurrentOutTxParam().OutboundTxHash
if txid == "" {
return "", fmt.Errorf("getOutTxidByNonce: cannot find outTx txid for nonce %d", nonce)
}
// make sure it's a real Bitcoin txid
_, getTxResult, err := ob.GetTxResultByHash(txid)
if err != nil {
return "", errors.Wrapf(err, "getOutTxidByNonce: error getting outTx result for nonce %d hash %s", nonce, txid)
}
if getTxResult.Confirmations <= 0 { // just a double check
return "", fmt.Errorf("getOutTxidByNonce: outTx txid %s for nonce %d is not included", txid, nonce)
}
return txid, nil
}
return "", fmt.Errorf("getOutTxidByNonce: cannot find outTx txid for nonce %d", nonce)
}
func (ob *BitcoinChainClient) findNonceMarkUTXO(nonce uint64, txid string) (int, error) {
tssAddress := ob.Tss.BTCAddressWitnessPubkeyHash().EncodeAddress()
amount := common.NonceMarkAmount(nonce)
for i, utxo := range ob.utxos {
sats, err := getSatoshis(utxo.Amount)
if err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msgf("findNonceMarkUTXO: error getting satoshis for utxo %v", utxo)
}
if utxo.Address == tssAddress && sats == amount && utxo.TxID == txid {
ob.logger.ObserveOutTx.Info().Msgf("findNonceMarkUTXO: found nonce-mark utxo with txid %s, amount %d satoshi", utxo.TxID, sats)
return i, nil
}
}
return -1, fmt.Errorf("findNonceMarkUTXO: cannot find nonce-mark utxo with nonce %d", nonce)
}
// SelectUTXOs selects a sublist of utxos to be used as inputs.
//
// Parameters:
// - amount: The desired minimum total value of the selected UTXOs.
// - utxos2Spend: The maximum number of UTXOs to spend.
// - nonce: The nonce of the outbound transaction.
// - consolidateRank: The rank below which UTXOs will be consolidated.
// - test: true for unit test only.
//
// Returns:
// - a sublist (includes previous nonce-mark) of UTXOs or an error if the qualifying sublist cannot be found.
// - the total value of the selected UTXOs.
// - the number of consolidated UTXOs.
// - the total value of the consolidated UTXOs.
func (ob *BitcoinChainClient) SelectUTXOs(amount float64, utxosToSpend uint16, nonce uint64, consolidateRank uint16, test bool) ([]btcjson.ListUnspentResult, float64, uint16, float64, error) {
idx := -1
if nonce == 0 {
// for nonce = 0; make exception; no need to include nonce-mark utxo
ob.Mu.Lock()
defer ob.Mu.Unlock()
} else {
// for nonce > 0; we proceed only when we see the nonce-mark utxo
preTxid, err := ob.getOutTxidByNonce(nonce-1, test)
if err != nil {
return nil, 0, 0, 0, err
}
ob.Mu.Lock()
defer ob.Mu.Unlock()
idx, err = ob.findNonceMarkUTXO(nonce-1, preTxid)
if err != nil {
return nil, 0, 0, 0, err
}
}
// select smallest possible UTXOs to make payment
total := 0.0
left, right := 0, 0
for total < amount && right < len(ob.utxos) {
if utxosToSpend > 0 { // expand sublist
total += ob.utxos[right].Amount
right++
utxosToSpend--
} else { // pop the smallest utxo and append the current one
total -= ob.utxos[left].Amount
total += ob.utxos[right].Amount
left++
right++
}
}
results := make([]btcjson.ListUnspentResult, right-left)
copy(results, ob.utxos[left:right])
// include nonce-mark as the 1st input
if idx >= 0 { // for nonce > 0
if idx < left || idx >= right {
total += ob.utxos[idx].Amount
results = append([]btcjson.ListUnspentResult{ob.utxos[idx]}, results...)
} else { // move nonce-mark to left
for i := idx - left; i > 0; i-- {
results[i], results[i-1] = results[i-1], results[i]
}
}
}
if total < amount {
return nil, 0, 0, 0, fmt.Errorf("SelectUTXOs: not enough btc in reserve - available : %v , tx amount : %v", total, amount)
}
// consolidate biggest possible UTXOs to maximize consolidated value
// consolidation happens only when there are more than (or equal to) consolidateRank (10) UTXOs
utxoRank, consolidatedUtxo, consolidatedValue := uint16(0), uint16(0), 0.0
for i := len(ob.utxos) - 1; i >= 0 && utxosToSpend > 0; i-- { // iterate over UTXOs big-to-small
if i != idx && (i < left || i >= right) { // exclude nonce-mark and already selected UTXOs
utxoRank++
if utxoRank >= consolidateRank { // consolication starts from the 10-ranked UTXO based on value
utxosToSpend--
consolidatedUtxo++
total += ob.utxos[i].Amount
consolidatedValue += ob.utxos[i].Amount
results = append(results, ob.utxos[i])
}
}
}
return results, total, consolidatedUtxo, consolidatedValue, nil
}
// SaveBroadcastedTx saves successfully broadcasted transaction
func (ob *BitcoinChainClient) SaveBroadcastedTx(txHash string, nonce uint64) {
outTxID := ob.GetTxID(nonce)
ob.Mu.Lock()
ob.broadcastedTx[outTxID] = txHash
ob.Mu.Unlock()
broadcastEntry := clienttypes.ToOutTxHashSQLType(txHash, outTxID)
if err := ob.db.Save(&broadcastEntry).Error; err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: error saving broadcasted tx")
}
}
func (ob *BitcoinChainClient) GetPendingCctxParams(nonce uint64) (types.OutboundTxParams, error) {
send, err := ob.zetaClient.GetCctxByNonce(ob.chain.ChainId, nonce)
if err != nil {
return types.OutboundTxParams{}, err
}
if send.GetCurrentOutTxParam() == nil { // never happen
return types.OutboundTxParams{}, fmt.Errorf("GetPendingCctx: nil outbound tx params")
}
if send.CctxStatus.Status == types.CctxStatus_PendingOutbound || send.CctxStatus.Status == types.CctxStatus_PendingRevert {
return *send.GetCurrentOutTxParam(), nil
}
return types.OutboundTxParams{}, fmt.Errorf("GetPendingCctx: not a pending cctx")
}
func (ob *BitcoinChainClient) observeOutTx() {
ticker := NewDynamicTicker("Bitcoin_observeOutTx", ob.GetCoreParams().OutTxTicker)
defer ticker.Stop()
for {
select {
case <-ticker.C():
trackers, err := ob.zetaClient.GetAllOutTxTrackerByChain(ob.chain, Ascending)
if err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: error GetAllOutTxTrackerByChain")
continue
}
for _, tracker := range trackers {
// get original cctx parameters
outTxID := ob.GetTxID(tracker.Nonce)
params, err := ob.GetPendingCctxParams(tracker.Nonce)
if err != nil {
ob.logger.ObserveOutTx.Info().Err(err).Msgf("observeOutTx: can't find pending cctx for nonce %d", tracker.Nonce)
break
}
if tracker.Nonce != params.OutboundTxTssNonce { // Tanmay: it doesn't hurt to check
ob.logger.ObserveOutTx.Error().Msgf("observeOutTx: tracker nonce %d not match cctx nonce %d", tracker.Nonce, params.OutboundTxTssNonce)
break
}
if len(tracker.HashList) > 1 {
ob.logger.ObserveOutTx.Warn().Msgf("observeOutTx: oops, outTxID %s got multiple (%d) outTx hashes", outTxID, len(tracker.HashList))
}
// verify outTx hashes
for _, txHash := range tracker.HashList {
_, err := ob.checkNSaveIncludedTx(txHash.TxHash, params)
if err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: checkNSaveIncludedTx failed")
}
}
}
ticker.UpdateInterval(ob.GetCoreParams().OutTxTicker, ob.logger.ObserveOutTx)
case <-ob.stop:
ob.logger.ObserveOutTx.Info().Msg("observeOutTx stopped")
return
}
}
}
// checkNSaveIncludedTx either includes a new outTx or update an existing outTx result.
// Returns inMempool, error
func (ob *BitcoinChainClient) checkNSaveIncludedTx(txHash string, params types.OutboundTxParams) (bool, error) {
outTxID := ob.GetTxID(params.OutboundTxTssNonce)
hash, getTxResult, err := ob.GetTxResultByHash(txHash)
if err != nil {
return false, errors.Wrapf(err, "checkNSaveIncludedTx: error GetTxResultByHash: %s", txHash)
}
if getTxResult.Confirmations >= 0 { // check included tx only
err = ob.checkTssOutTxResult(hash, getTxResult, params, params.OutboundTxTssNonce)
if err != nil {
return false, errors.Wrapf(err, "checkNSaveIncludedTx: error verify bitcoin outTx %s outTxID %s", txHash, outTxID)
}
ob.Mu.Lock()
defer ob.Mu.Unlock()
nonce, foundHash := ob.includedTxHashes[txHash]
res, foundRes := ob.includedTxResults[outTxID]
// include new outTx and enforce rigid 1-to-1 mapping: outTxID(nonce) <===> txHash
if !foundHash && !foundRes {
ob.includedTxHashes[txHash] = params.OutboundTxTssNonce
ob.includedTxResults[outTxID] = *getTxResult
if params.OutboundTxTssNonce >= ob.pendingNonce { // try increasing pending nonce on every newly included outTx
ob.pendingNonce = params.OutboundTxTssNonce + 1
}
ob.logger.ObserveOutTx.Info().Msgf("checkNSaveIncludedTx: included new bitcoin outTx %s outTxID %s pending nonce %d", txHash, outTxID, ob.pendingNonce)
}
// update saved tx result as confirmations may increase
if foundHash && foundRes {
ob.includedTxResults[outTxID] = *getTxResult
if getTxResult.Confirmations > res.Confirmations {
ob.logger.ObserveOutTx.Info().Msgf("checkNSaveIncludedTx: bitcoin outTx %s got confirmations %d", txHash, getTxResult.Confirmations)
}
}
if !foundHash && foundRes { // be alert for duplicate payment!!! As we got a new hash paying same cctx. It might happen (e.g. majority of signers get crupted)
ob.logger.ObserveOutTx.Error().Msgf("checkNSaveIncludedTx: duplicate payment by bitcoin outTx %s outTxID %s, prior result %v, current result %v", txHash, outTxID, res, *getTxResult)
}
if foundHash && !foundRes {
ob.logger.ObserveOutTx.Error().Msgf("checkNSaveIncludedTx: unreachable code path! outTx %s outTxID %s, prior nonce %d, current nonce %d", txHash, outTxID, nonce, params.OutboundTxTssNonce)
}
return false, nil
}
return true, nil // in mempool
}
// Basic TSS outTX checks:
// - should be able to query the raw tx
// - check if all inputs are segwit && TSS inputs
//
// Returns: true if outTx passes basic checks.
func (ob *BitcoinChainClient) checkTssOutTxResult(hash *chainhash.Hash, res *btcjson.GetTransactionResult, params types.OutboundTxParams, nonce uint64) error {
rawResult, err := ob.getRawTxResult(hash, res)
if err != nil {
return errors.Wrapf(err, "checkTssOutTxResult: error GetRawTxResultByHash %s", hash.String())
}
err = ob.checkTSSVin(rawResult.Vin, nonce)
if err != nil {
return errors.Wrapf(err, "checkTssOutTxResult: invalid TSS Vin in outTx %s nonce %d", hash, nonce)
}
err = ob.checkTSSVout(rawResult.Vout, params, nonce)
if err != nil {
return errors.Wrapf(err, "checkTssOutTxResult: invalid TSS Vout in outTx %s nonce %d", hash, nonce)
}
return nil
}
func (ob *BitcoinChainClient) GetTxResultByHash(txID string) (*chainhash.Hash, *btcjson.GetTransactionResult, error) {
hash, err := chainhash.NewHashFromStr(txID)
if err != nil {
return nil, nil, errors.Wrapf(err, "GetTxResultByHash: error NewHashFromStr: %s", txID)
}
// The Bitcoin node has to be configured to watch TSS address
txResult, err := ob.rpcClient.GetTransaction(hash)
if err != nil {
return nil, nil, errors.Wrapf(err, "GetOutTxByTxHash: error GetTransaction %s", hash.String())
}
return hash, txResult, nil
}
func (ob *BitcoinChainClient) getRawTxResult(hash *chainhash.Hash, res *btcjson.GetTransactionResult) (btcjson.TxRawResult, error) {
if res.Confirmations == 0 { // for pending tx, we query the raw tx directly
rawResult, err := ob.rpcClient.GetRawTransactionVerbose(hash) // for pending tx, we query the raw tx
if err != nil {
return btcjson.TxRawResult{}, errors.Wrapf(err, "getRawTxResult: error GetRawTransactionVerbose %s", res.TxID)
}
return *rawResult, nil
} else if res.Confirmations > 0 { // for confirmed tx, we query the block
blkHash, err := chainhash.NewHashFromStr(res.BlockHash)
if err != nil {
return btcjson.TxRawResult{}, errors.Wrapf(err, "getRawTxResult: error NewHashFromStr for block hash %s", res.BlockHash)
}
block, err := ob.rpcClient.GetBlockVerboseTx(blkHash)
if err != nil {
return btcjson.TxRawResult{}, errors.Wrapf(err, "getRawTxResult: error GetBlockVerboseTx %s", res.BlockHash)
}
if res.BlockIndex < 0 || res.BlockIndex >= int64(len(block.Tx)) {
return btcjson.TxRawResult{}, errors.Wrapf(err, "getRawTxResult: invalid outTx with invalid block index, TxID %s, BlockIndex %d", res.TxID, res.BlockIndex)
}
return block.Tx[res.BlockIndex], nil
} else { // res.Confirmations < 0 (meaning not included)
return btcjson.TxRawResult{}, fmt.Errorf("getRawTxResult: tx %s not included yet", hash)
}
}
// checkTSSVin checks vin is valid if:
// - The first input is the nonce-mark
// - All inputs are from TSS address
func (ob *BitcoinChainClient) checkTSSVin(vins []btcjson.Vin, nonce uint64) error {
// vins: [nonce-mark, UTXO1, UTXO2, ...]
if nonce > 0 && len(vins) <= 1 {
return fmt.Errorf("checkTSSVin: len(vins) <= 1")
}
pubKeyTss := hex.EncodeToString(ob.Tss.PubKeyCompressedBytes())
for i, vin := range vins {
// The length of the Witness should be always 2 for SegWit inputs.
if len(vin.Witness) != 2 {
return fmt.Errorf("checkTSSVin: expected 2 witness items, got %d", len(vin.Witness))
}
if vin.Witness[1] != pubKeyTss {
return fmt.Errorf("checkTSSVin: witness pubkey %s not match TSS pubkey %s", vin.Witness[1], pubKeyTss)
}
// 1st vin: nonce-mark MUST come from prior TSS outTx
if nonce > 0 && i == 0 {
preTxid, err := ob.getOutTxidByNonce(nonce-1, false)
if err != nil {
return fmt.Errorf("checkTSSVin: error findTxIDByNonce %d", nonce-1)
}
// nonce-mark MUST the 1st output that comes from prior TSS outTx
if vin.Txid != preTxid || vin.Vout != 0 {
return fmt.Errorf("checkTSSVin: invalid nonce-mark txid %s vout %d, expected txid %s vout 0", vin.Txid, vin.Vout, preTxid)
}
}
}
return nil
}
// checkTSSVout vout is valid if:
// - The first output is the nonce-mark
// - The second output is the correct payment to recipient
// - The third output is the change to TSS (optional)
func (ob *BitcoinChainClient) checkTSSVout(vouts []btcjson.Vout, params types.OutboundTxParams, nonce uint64) error {
// vouts: [nonce-mark, payment to recipient, change to TSS (optional)]
if !(len(vouts) == 2 || len(vouts) == 3) {
return fmt.Errorf("checkTSSVout: invalid number of vouts: %d", len(vouts))
}
tssAddress := ob.Tss.BTCAddress()
for _, vout := range vouts {
amount, err := getSatoshis(vout.Value)
if err != nil {
return errors.Wrap(err, "checkTSSVout: error getting satoshis")
}
// decode P2WPKH scriptPubKey
scriptPubKey := vout.ScriptPubKey.Hex
decodedScriptPubKey, err := hex.DecodeString(scriptPubKey)
if err != nil {
return errors.Wrapf(err, "checkTSSVout: error decoding scriptPubKey %s", scriptPubKey)
}
if len(decodedScriptPubKey) != 22 { // P2WPKH script
return fmt.Errorf("checkTSSVout: unsupported scriptPubKey: %s", scriptPubKey)
}
witnessVersion := decodedScriptPubKey[0]
witnessProgram := decodedScriptPubKey[2:]
if witnessVersion != 0 {
return fmt.Errorf("checkTSSVout: unsupported witness in scriptPubKey %s", scriptPubKey)
}
recvAddress, err := ob.chain.BTCAddressFromWitnessProgram(witnessProgram)
if err != nil {
return errors.Wrapf(err, "checkTSSVout: error getting receiver from witness program %s", witnessProgram)
}
// 1st vout: nonce-mark
if vout.N == 0 {
if recvAddress != tssAddress {
return fmt.Errorf("checkTSSVout: nonce-mark address %s not match TSS address %s", recvAddress, tssAddress)
}
if amount != common.NonceMarkAmount(nonce) {
return fmt.Errorf("checkTSSVout: nonce-mark amount %d not match nonce-mark amount %d", amount, common.NonceMarkAmount(nonce))
}
}
// 2nd vout: payment to recipient
if vout.N == 1 {
if recvAddress != params.Receiver {
return fmt.Errorf("checkTSSVout: output address %s not match params receiver %s", recvAddress, params.Receiver)
}
// #nosec G701 always positive
if uint64(amount) != params.Amount.Uint64() {
return fmt.Errorf("checkTSSVout: output amount %d not match params amount %d", amount, params.Amount)
}
}
// 3rd vout: change to TSS (optional)
if vout.N == 2 {
if recvAddress != tssAddress {
return fmt.Errorf("checkTSSVout: change address %s not match TSS address %s", recvAddress, tssAddress)
}
}
}
return nil
}
func (ob *BitcoinChainClient) BuildBroadcastedTxMap() error {
var broadcastedTransactions []clienttypes.OutTxHashSQLType
if err := ob.db.Find(&broadcastedTransactions).Error; err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("error iterating over db")
return err
}
for _, entry := range broadcastedTransactions {
ob.broadcastedTx[entry.Key] = entry.Hash
}
return nil
}
func (ob *BitcoinChainClient) LoadLastBlock() error {
bn, err := ob.rpcClient.GetBlockCount()
if err != nil {
return err
}
//Load persisted block number
var lastBlockNum clienttypes.LastBlockSQLType
if err := ob.db.First(&lastBlockNum, clienttypes.LastBlockNumID).Error; err != nil {
ob.logger.ChainLogger.Info().Msg("LastBlockNum not found in DB, scan from latest")
ob.SetLastBlockHeightScanned(bn)
} else {
ob.SetLastBlockHeightScanned(lastBlockNum.Num)
//If persisted block number is too low, use the latest height
if (bn - lastBlockNum.Num) > maxHeightDiff {
ob.logger.ChainLogger.Info().Msgf("LastBlockNum too low: %d, scan from latest", lastBlockNum.Num)
ob.SetLastBlockHeightScanned(bn)
}
}
if ob.chain.ChainId == 18444 { // bitcoin regtest: start from block 100
ob.SetLastBlockHeightScanned(100)
}
ob.logger.ChainLogger.Info().Msgf("%s: start scanning from block %d", ob.chain.String(), ob.lastBlock)
return nil
}
func (ob *BitcoinChainClient) loadDB(dbpath string) error {
if _, err := os.Stat(dbpath); os.IsNotExist(err) {
err := os.MkdirAll(dbpath, os.ModePerm)
if err != nil {
return err
}
}
path := fmt.Sprintf("%s/btc_chain_client", dbpath)
db, err := gorm.Open(sqlite.Open(path), &gorm.Config{Logger: logger.Default.LogMode(logger.Silent)})
if err != nil {
panic("failed to connect database")
}
ob.db = db
err = db.AutoMigrate(&clienttypes.TransactionResultSQLType{},
&clienttypes.OutTxHashSQLType{},
&clienttypes.LastBlockSQLType{})
if err != nil {
return err
}
//Load last block
err = ob.LoadLastBlock()
if err != nil {
return err
}
//Load broadcasted transactions
err = ob.BuildBroadcastedTxMap()
return err
}
func (ob *BitcoinChainClient) GetTxID(nonce uint64) string {
tssAddr := ob.Tss.BTCAddress()
return fmt.Sprintf("%d-%s-%d", ob.chain.ChainId, tssAddr, nonce)
}
type BTCBlockNHeader struct {
Header *wire.BlockHeader
Block *btcjson.GetBlockVerboseTxResult
}
func (ob *BitcoinChainClient) GetBlockByNumberCached(blockNumber int64) (*BTCBlockNHeader, error) {
if result, ok := ob.BlockCache.Get(blockNumber); ok {
return result.(*BTCBlockNHeader), nil
}
// Get the block hash
hash, err := ob.rpcClient.GetBlockHash(blockNumber)
if err != nil {
return nil, err
}
// Get the block header
header, err := ob.rpcClient.GetBlockHeader(hash)
if err != nil {
return nil, err
}
// Get the block with verbose transactions
block, err := ob.rpcClient.GetBlockVerboseTx(hash)
if err != nil {
return nil, err
}
blockNheader := &BTCBlockNHeader{
Header: header,
Block: block,
}
ob.BlockCache.Add(blockNumber, blockNheader)
ob.BlockCache.Add(hash, blockNheader)
return blockNheader, nil
}
package zetaclient
import (
"context"
"fmt"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)
// GetBlockHeight returns the current height for metachain blocks
// FIXME: deprecate this in favor of tendermint RPC?
func (b *ZetaCoreBridge) GetBlockHeight() (int64, error) {
client := types.NewQueryClient(b.grpcConn)
height, err := client.LastZetaHeight(
context.Background(),
&types.QueryLastZetaHeightRequest{},
)
if err != nil {
return 0, err
}
fmt.Printf("block height: %d\n", height.Height)
return height.Height, nil
}
package zetaclient
import (
"fmt"
"regexp"
"strconv"
"strings"
"github.com/cosmos/cosmos-sdk/client"
clienttx "github.com/cosmos/cosmos-sdk/client/tx"
sdktypes "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
flag "github.com/spf13/pflag"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)
// Broadcast Broadcasts tx to metachain. Returns txHash and error
func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg, authzSigner AuthZSigner) (string, error) {
gaslimit = gaslimit * 3
b.broadcastLock.Lock()
defer b.broadcastLock.Unlock()
var err error
blockHeight, err := b.GetZetaBlockHeight()
if err != nil {
return "", err
}
if blockHeight > b.blockHeight {
b.blockHeight = blockHeight
accountNumber, seqNumber, err := b.GetAccountNumberAndSequenceNumber(authzSigner.KeyType)
if err != nil {
return "", err
}
b.accountNumber[authzSigner.KeyType] = accountNumber
if b.seqNumber[authzSigner.KeyType] < seqNumber {
b.seqNumber[authzSigner.KeyType] = seqNumber
}
}
//b.logger.Info().Uint64("account_number", b.accountNumber).Uint64("sequence_number", b.seqNumber).Msg("account info")
flags := flag.NewFlagSet("zetacore", 0)
ctx := b.GetContext()
factory := clienttx.NewFactoryCLI(ctx, flags)
factory = factory.WithAccountNumber(b.accountNumber[authzSigner.KeyType])
factory = factory.WithSequence(b.seqNumber[authzSigner.KeyType])
factory = factory.WithSignMode(signing.SignMode_SIGN_MODE_DIRECT)
builder, err := factory.BuildUnsignedTx(authzWrappedMsg)
if err != nil {
return "", err
}
builder.SetGasLimit(gaslimit)
fee := sdktypes.NewCoins(sdktypes.NewCoin("azeta", sdktypes.NewInt(40000)))
builder.SetFeeAmount(fee)
//fmt.Printf("signing from name: %s\n", ctx.GetFromName())
err = clienttx.Sign(factory, ctx.GetFromName(), builder, true)
if err != nil {
return "", err
}
txBytes, err := ctx.TxConfig.TxEncoder()(builder.GetTx())
if err != nil {
return "", err
}
// broadcast to a Tendermint node
commit, err := ctx.BroadcastTxSync(txBytes)
if err != nil {
b.logger.Error().Err(err).Msgf("fail to broadcast tx %s", err.Error())
return "", err
}
// Code will be the tendermint ABICode , it start at 1 , so if it is an error , code will not be zero
if commit.Code > 0 {
if commit.Code == 32 {
errMsg := commit.RawLog
re := regexp.MustCompile(`account sequence mismatch, expected ([0-9]*), got ([0-9]*)`)
matches := re.FindStringSubmatch(errMsg)
if len(matches) != 3 {
return "", err
}
expectedSeq, err := strconv.ParseUint(matches[1], 10, 64)
if err != nil {
b.logger.Warn().Msgf("cannot parse expected seq %s", matches[1])
return "", err
}
gotSeq, err := strconv.Atoi(matches[2])
if err != nil {
b.logger.Warn().Msgf("cannot parse got seq %s", matches[2])
return "", err
}
b.seqNumber[authzSigner.KeyType] = expectedSeq
b.logger.Warn().Msgf("Reset seq number to %d (from err msg) from %d", b.seqNumber[authzSigner.KeyType], gotSeq)
}
return commit.TxHash, fmt.Errorf("fail to broadcast to zetachain,code:%d, log:%s", commit.Code, commit.RawLog)
}
//b.logger.Debug().Msgf("Received a TxHash of %v from the metachain, Code %d, log %s", commit.TxHash, commit.Code, commit.Logs)
// increment seqNum
//seq := b.seqNumber[authzSigner.KeyType]
//atomic.AddUint64(&seq, 1)
b.seqNumber[authzSigner.KeyType] = b.seqNumber[authzSigner.KeyType] + 1
//b.logger.Debug().Msgf("b.sequence number increased to %d", b.seqNumber)
return commit.TxHash, nil
}
// GetContext return a valid context with all relevant values set
func (b *ZetaCoreBridge) GetContext() client.Context {
ctx := client.Context{}
addr, err := b.keys.GetSignerInfo().GetAddress()
if err != nil {
// TODO : Handle error
b.logger.Error().Err(err).Msg("fail to get address from key")
}
ctx = ctx.WithKeyring(b.keys.GetKeybase())
ctx = ctx.WithChainID(b.zetaChainID)
ctx = ctx.WithHomeDir(b.cfg.ChainHomeFolder)
ctx = ctx.WithFromName(b.cfg.SignerName)
ctx = ctx.WithFromAddress(addr)
ctx = ctx.WithBroadcastMode("sync")
ctx = ctx.WithCodec(b.encodingCfg.Codec)
ctx = ctx.WithInterfaceRegistry(b.encodingCfg.InterfaceRegistry)
ctx = ctx.WithTxConfig(b.encodingCfg.TxConfig)
ctx = ctx.WithLegacyAmino(b.encodingCfg.Amino)
ctx = ctx.WithAccountRetriever(authtypes.AccountRetriever{})
remote := b.cfg.ChainRPC
if !strings.HasPrefix(b.cfg.ChainHost, "http") {
remote = fmt.Sprintf("tcp://%s", remote)
}
//fmt.Println("ctx.remote ", remote)
ctx = ctx.WithNodeURI(remote)
client, err := rpchttp.New(remote, "/websocket")
if err != nil {
panic(err)
}
ctx = ctx.WithClient(client)
return ctx
}
package zetaclient
import (
"bytes"
"encoding/hex"
"fmt"
"math/big"
"math/rand"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/rpcclient"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/rs/zerolog"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
)
const (
maxNoOfInputsPerTx = 20
consolidationRank = 10 // the rank below (or equal to) which we consolidate UTXOs
outTxBytesMin = 400 // 500B is an estimated size for a 2-input, 3-output SegWit tx
outTxBytesMax = 3250 // 3250B is an estimated size for a 21-input, 3-output SegWit tx
outTxBytesCap = 10_000 // in case of accident
// for ZRC20 configuration
bytesPerInput = 150 // each input is about 150 bytes
ZRC20GasLimit = outTxBytesMin + bytesPerInput*8 // 1600B a suggested ZRC20 GAS_LIMIT for a 10-input, 3-output SegWit tx
)
type BTCSigner struct {
tssSigner TSSSigner
rpcClient BTCRPCClient
logger zerolog.Logger
ts *TelemetryServer
}
var _ ChainSigner = &BTCSigner{}
func NewBTCSigner(cfg config.BTCConfig, tssSigner TSSSigner, logger zerolog.Logger, ts *TelemetryServer) (*BTCSigner, error) {
connCfg := &rpcclient.ConnConfig{
Host: cfg.RPCHost,
User: cfg.RPCUsername,
Pass: cfg.RPCPassword,
HTTPPostMode: true,
DisableTLS: true,
Params: cfg.RPCParams,
}
client, err := rpcclient.New(connCfg, nil)
if err != nil {
return nil, fmt.Errorf("error creating bitcoin rpc client: %s", err)
}
return &BTCSigner{
tssSigner: tssSigner,
rpcClient: client,
logger: logger.With().
Str("chain", "BTC").
Str("module", "BTCSigner").Logger(),
ts: ts,
}, nil
}
// SignWithdrawTx receives utxos sorted by value, amount in BTC, feeRate in BTC per Kb
func (signer *BTCSigner) SignWithdrawTx(
to *btcutil.AddressWitnessPubKeyHash,
amount float64,
gasPrice *big.Int,
sizeLimit uint64,
btcClient *BitcoinChainClient,
height uint64,
nonce uint64,
chain *common.Chain,
) (*wire.MsgTx, error) {
estimateFee := float64(gasPrice.Uint64()) * outTxBytesMax / 1e8
nonceMark := common.NonceMarkAmount(nonce)
// refresh unspent UTXOs and continue with keysign regardless of error
err := btcClient.FetchUTXOS()
if err != nil {
signer.logger.Error().Err(err).Msgf("SignWithdrawTx: FetchUTXOS error: nonce %d chain %d", nonce, chain.ChainId)
}
// select N UTXOs to cover the total expense
prevOuts, total, consolidatedUtxo, consolidatedValue, err := btcClient.SelectUTXOs(amount+estimateFee+float64(nonceMark)*1e-8, maxNoOfInputsPerTx, nonce, consolidationRank, false)
if err != nil {
return nil, err
}
// build tx with selected unspents
tx := wire.NewMsgTx(wire.TxVersion)
for _, prevOut := range prevOuts {
hash, err := chainhash.NewHashFromStr(prevOut.TxID)
if err != nil {
return nil, err
}
outpoint := wire.NewOutPoint(hash, prevOut.Vout)
txIn := wire.NewTxIn(outpoint, nil, nil)
tx.AddTxIn(txIn)
}
amountSatoshis, err := getSatoshis(amount)
if err != nil {
return nil, err
}
// size checking
// #nosec G701 check as positive
txSize := uint64(tx.SerializeSize())
if txSize > sizeLimit { // ZRC20 'withdraw' charged less fee from end user
signer.logger.Info().Msgf("sizeLimit %d is less than txSize %d for nonce %d", sizeLimit, txSize, nonce)
}
if txSize < outTxBytesMin { // outbound shouldn't be blocked a low sizeLimit
signer.logger.Warn().Msgf("sizeLimit %d is less than outTxBytesMin %d; use outTxBytesMin", sizeLimit, outTxBytesMin)
txSize = outTxBytesMin
}
if txSize > outTxBytesCap { // in case of accident
signer.logger.Warn().Msgf("sizeLimit %d is greater than outTxBytesCap %d; use outTxBytesCap", sizeLimit, outTxBytesCap)
txSize = outTxBytesCap
}
// fee calculation
// #nosec G701 always in range (checked above)
fees := new(big.Int).Mul(big.NewInt(int64(txSize)), gasPrice)
signer.logger.Info().Msgf("bitcoin outTx nonce %d gasPrice %s size %d fees %s consolidated %d utxos of value %v",
nonce, gasPrice.String(), txSize, fees.String(), consolidatedUtxo, consolidatedValue)
// calculate remaining btc to TSS self
tssAddrWPKH := signer.tssSigner.BTCAddressWitnessPubkeyHash()
payToSelf, err := payToWitnessPubKeyHashScript(tssAddrWPKH.WitnessProgram())
if err != nil {
return nil, err
}
remaining := total - amount
remainingSats, err := getSatoshis(remaining)
if err != nil {
return nil, err
}
remainingSats -= fees.Int64()
remainingSats -= nonceMark
if remainingSats < 0 {
fmt.Printf("BTCSigner: SignWithdrawTx: Remainder Value is negative! : %d\n", remainingSats)
fmt.Printf("BTCSigner: SignWithdrawTx: Number of inputs : %d\n", len(tx.TxIn))
return nil, fmt.Errorf("remainder value is negative")
} else if remainingSats == nonceMark {
fmt.Printf("BTCSigner: SignWithdrawTx: Adjust remainder value to avoid duplicate nonce-mark: %d\n", remainingSats)
remainingSats--
}
// 1st output: the nonce-mark btc to TSS self
txOut1 := wire.NewTxOut(nonceMark, payToSelf)
tx.AddTxOut(txOut1)
// 2nd output: the payment to the recipient
pkScript, err := payToWitnessPubKeyHashScript(to.WitnessProgram())
if err != nil {
return nil, err
}
txOut2 := wire.NewTxOut(amountSatoshis, pkScript)
tx.AddTxOut(txOut2)
// 3rd output: the remaining btc to TSS self
if remainingSats > 0 {
txOut3 := wire.NewTxOut(remainingSats, payToSelf)
tx.AddTxOut(txOut3)
}
// sign the tx
sigHashes := txscript.NewTxSigHashes(tx)
witnessHashes := make([][]byte, len(tx.TxIn))
for ix := range tx.TxIn {
amt, err := getSatoshis(prevOuts[ix].Amount)
if err != nil {
return nil, err
}
pkScript, err := hex.DecodeString(prevOuts[ix].ScriptPubKey)
if err != nil {
return nil, err
}
witnessHashes[ix], err = txscript.CalcWitnessSigHash(pkScript, sigHashes, txscript.SigHashAll, tx, ix, amt)
if err != nil {
return nil, err
}
}
tss, ok := signer.tssSigner.(*TSS)
if !ok {
return nil, fmt.Errorf("tssSigner is not a TSS")
}
sig65Bs, err := tss.SignBatch(witnessHashes, height, nonce, chain)
if err != nil {
return nil, fmt.Errorf("SignBatch error: %v", err)
}
for ix := range tx.TxIn {
sig65B := sig65Bs[ix]
R := big.NewInt(0).SetBytes(sig65B[:32])
S := big.NewInt(0).SetBytes(sig65B[32:64])
sig := btcec.Signature{
R: R,
S: S,
}
pkCompressed := signer.tssSigner.PubKeyCompressedBytes()
hashType := txscript.SigHashAll
txWitness := wire.TxWitness{append(sig.Serialize(), byte(hashType)), pkCompressed}
tx.TxIn[ix].Witness = txWitness
}
return tx, nil
}
func (signer *BTCSigner) Broadcast(signedTx *wire.MsgTx) error {
fmt.Printf("BTCSigner: Broadcasting: %s\n", signedTx.TxHash().String())
var outBuff bytes.Buffer
err := signedTx.Serialize(&outBuff)
if err != nil {
return err
}
str := hex.EncodeToString(outBuff.Bytes())
fmt.Printf("BTCSigner: Transaction Data: %s\n", str)
hash, err := signer.rpcClient.SendRawTransaction(signedTx, true)
if err != nil {
return err
}
signer.logger.Info().Msgf("Broadcasting BTC tx , hash %s ", hash)
return nil
}
func (signer *BTCSigner) TryProcessOutTx(
send *types.CrossChainTx,
outTxMan *OutTxProcessorManager,
outTxID string,
chainclient ChainClient,
zetaBridge ZetaCoreBridger,
height uint64,
) {
defer func() {
outTxMan.EndTryProcess(outTxID)
if err := recover(); err != nil {
signer.logger.Error().Msgf("BTC TryProcessOutTx: %s, caught panic error: %v", send.Index, err)
}
}()
logger := signer.logger.With().
Str("OutTxID", outTxID).
Str("SendHash", send.Index).
Logger()
params := send.GetCurrentOutTxParam()
if params.CoinType == common.CoinType_Zeta || params.CoinType == common.CoinType_ERC20 {
logger.Error().Msgf("BTC TryProcessOutTx: can only send BTC to a BTC network")
return
}
logger.Info().Msgf("BTC TryProcessOutTx: %s, value %d to %s", send.Index, params.Amount.BigInt(), params.Receiver)
btcClient, ok := chainclient.(*BitcoinChainClient)
if !ok {
logger.Error().Msgf("chain client is not a bitcoin client")
return
}
flags, err := zetaBridge.GetCrosschainFlags()
if err != nil {
logger.Error().Err(err).Msgf("cannot get crosschain flags")
return
}
if !flags.IsOutboundEnabled {
logger.Info().Msgf("outbound is disabled")
return
}
myid := zetaBridge.GetKeys().GetAddress()
// Early return if the send is already processed
// FIXME: handle revert case
outboundTxTssNonce := params.OutboundTxTssNonce
included, confirmed, err := btcClient.IsSendOutTxProcessed(send.Index, outboundTxTssNonce, common.CoinType_Gas, logger)
if err != nil {
logger.Error().Err(err).Msgf("cannot check if send %s is processed", send.Index)
return
}
if included || confirmed {
logger.Info().Msgf("CCTX %s already processed; exit signer", outTxID)
return
}
sizelimit := params.OutboundTxGasLimit
gasprice, ok := new(big.Int).SetString(params.OutboundTxGasPrice, 10)
if !ok || gasprice.Cmp(big.NewInt(0)) < 0 {
logger.Error().Msgf("cannot convert gas price %s ", params.OutboundTxGasPrice)
return
}
// FIXME: config chain params
addr, err := btcutil.DecodeAddress(params.Receiver, config.BitconNetParams)
if err != nil {
logger.Error().Err(err).Msgf("cannot decode address %s ", params.Receiver)
return
}
to, ok := addr.(*btcutil.AddressWitnessPubKeyHash)
if err != nil || !ok {
logger.Error().Err(err).Msgf("cannot convert address %s to P2WPKH address", params.Receiver)
return
}
logger.Info().Msgf("SignWithdrawTx: to %s, value %d sats", addr.EncodeAddress(), params.Amount.Uint64())
logger.Info().Msgf("using utxos: %v", btcClient.utxos)
tx, err := signer.SignWithdrawTx(
to,
float64(params.Amount.Uint64())/1e8,
gasprice,
sizelimit,
btcClient,
height,
outboundTxTssNonce,
&btcClient.chain,
)
if err != nil {
logger.Warn().Err(err).Msgf("SignOutboundTx error: nonce %d chain %d", outboundTxTssNonce, params.ReceiverChainId)
return
}
logger.Info().Msgf("Key-sign success: %d => %s, nonce %d", send.InboundTxParams.SenderChainId, btcClient.chain.ChainName, outboundTxTssNonce)
// FIXME: add prometheus metrics
_, err = zetaBridge.GetObserverList(btcClient.chain)
if err != nil {
logger.Warn().Err(err).Msgf("unable to get observer list: chain %d observation %s", outboundTxTssNonce, observertypes.ObservationType_OutBoundTx.String())
}
if tx != nil {
outTxHash := tx.TxHash().String()
logger.Info().Msgf("on chain %s nonce %d, outTxHash %s signer %s", btcClient.chain.ChainName, outboundTxTssNonce, outTxHash, myid)
// TODO: pick a few broadcasters.
//if len(signers) == 0 || myid == signers[send.OutboundTxParams.Broadcaster] || myid == signers[int(send.OutboundTxParams.Broadcaster+1)%len(signers)] {
// retry loop: 1s, 2s, 4s, 8s, 16s in case of RPC error
for i := 0; i < 5; i++ {
// #nosec G404 randomness is not a security issue here
time.Sleep(time.Duration(rand.Intn(1500)) * time.Millisecond) //random delay to avoid sychronized broadcast
err := signer.Broadcast(tx)
if err != nil {
logger.Warn().Err(err).Msgf("broadcasting tx %s to chain %s: nonce %d, retry %d", outTxHash, btcClient.chain.ChainName, outboundTxTssNonce, i)
continue
}
logger.Info().Msgf("Broadcast success: nonce %d to chain %s outTxHash %s", outboundTxTssNonce, btcClient.chain.String(), outTxHash)
zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(btcClient.chain.ChainId, outboundTxTssNonce, outTxHash, nil, "", -1)
if err != nil {
logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", outboundTxTssNonce, btcClient.chain.ChainName, outTxHash)
}
logger.Info().Msgf("Broadcast to core successful %s", zetaHash)
// Save successfully broadcasted transaction to btc chain client
btcClient.SaveBroadcastedTx(outTxHash, outboundTxTssNonce)
break // successful broadcast; no need to retry
}
}
}
package zetaclient
import (
"errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/zeta-chain/zetacore/zetaclient/metrics"
)
const MetricGroup = "zetaclient"
type ChainMetrics struct {
chain string
metrics *metrics.Metrics
}
func NewChainMetrics(chain string, metrics *metrics.Metrics) *ChainMetrics {
return &ChainMetrics{
chain,
metrics,
}
}
func (m *ChainMetrics) GetPromGauge(name string) (prometheus.Gauge, error) {
gauge, found := metrics.Gauges[m.buildGroupName(name)]
if !found {
return nil, errors.New("gauge not found")
}
return gauge, nil
}
func (m *ChainMetrics) RegisterPromGauge(name string, help string) error {
gaugeName := m.buildGroupName(name)
return m.metrics.RegisterGauge(gaugeName, help)
}
func (m *ChainMetrics) GetPromCounter(name string) (prometheus.Counter, error) {
if cnt, found := metrics.Counters[m.buildGroupName(name)]; found {
return cnt, nil
}
return nil, errors.New("counter not found")
}
func (m *ChainMetrics) RegisterPromCounter(name string, help string) error {
cntName := m.buildGroupName(name)
return m.metrics.RegisterCounter(cntName, help)
}
func (m *ChainMetrics) buildGroupName(name string) string {
return MetricGroup + "_" + name + "_" + m.chain
}
package zetaclient
import (
"bytes"
"context"
"fmt"
"math"
"math/big"
"os"
"sort"
"strconv"
"sync"
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/rlp"
lru "github.com/hashicorp/golang-lru"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
metricsPkg "github.com/zeta-chain/zetacore/zetaclient/metrics"
clienttypes "github.com/zeta-chain/zetacore/zetaclient/types"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
type TxHashEnvelope struct {
TxHash string
Done chan struct{}
}
type OutTx struct {
SendHash string
TxHash string
Nonce int64
}
type EVMLog struct {
ChainLogger zerolog.Logger // Parent logger
ExternalChainWatcher zerolog.Logger // Observes external Chains for incoming trasnactions
WatchGasPrice zerolog.Logger // Observes external Chains for Gas prices and posts to core
ObserveOutTx zerolog.Logger // Observes external Chains for Outgoing transactions
}
const (
DonationMessage = "I am rich!"
)
// EVMChainClient represents the chain configuration for an EVM chain
// Filled with above constants depending on chain
type EVMChainClient struct {
*ChainMetrics
chain common.Chain
evmClient EVMRPCClient
KlaytnClient KlaytnRPCClient
zetaClient ZetaCoreBridger
Tss TSSSigner
lastBlockScanned int64
lastBlock int64
BlockTimeExternalChain uint64 // block time in seconds
txWatchList map[ethcommon.Hash]string
Mu *sync.Mutex
db *gorm.DB
outTXConfirmedReceipts map[string]*ethtypes.Receipt
outTXConfirmedTransaction map[string]*ethtypes.Transaction
MinNonce int64
MaxNonce int64
OutTxChan chan OutTx // send to this channel if you want something back!
stop chan struct{}
fileLogger *zerolog.Logger // for critical info
logger EVMLog
cfg *config.Config
params observertypes.CoreParams
ts *TelemetryServer
BlockCache *lru.Cache
}
var _ ChainClient = (*EVMChainClient)(nil)
// NewEVMChainClient returns a new configuration based on supplied target chain
func NewEVMChainClient(
bridge ZetaCoreBridger,
tss TSSSigner,
dbpath string,
metrics *metricsPkg.Metrics,
logger zerolog.Logger,
cfg *config.Config,
evmCfg config.EVMConfig,
ts *TelemetryServer,
) (*EVMChainClient, error) {
ob := EVMChainClient{
ChainMetrics: NewChainMetrics(evmCfg.Chain.ChainName.String(), metrics),
ts: ts,
}
chainLogger := logger.With().Str("chain", evmCfg.Chain.ChainName.String()).Logger()
ob.logger = EVMLog{
ChainLogger: chainLogger,
ExternalChainWatcher: chainLogger.With().Str("module", "ExternalChainWatcher").Logger(),
WatchGasPrice: chainLogger.With().Str("module", "WatchGasPrice").Logger(),
ObserveOutTx: chainLogger.With().Str("module", "ObserveOutTx").Logger(),
}
ob.cfg = cfg
ob.params = evmCfg.CoreParams
ob.stop = make(chan struct{})
ob.chain = evmCfg.Chain
ob.Mu = &sync.Mutex{}
ob.zetaClient = bridge
ob.txWatchList = make(map[ethcommon.Hash]string)
ob.Tss = tss
ob.outTXConfirmedReceipts = make(map[string]*ethtypes.Receipt)
ob.outTXConfirmedTransaction = make(map[string]*ethtypes.Transaction)
ob.OutTxChan = make(chan OutTx, 100)
logFile, err := os.OpenFile(ob.chain.ChainName.String()+"_debug.log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
log.Error().Err(err).Msgf("there was an error creating a logFile chain %s", ob.chain.ChainName.String())
}
fileLogger := zerolog.New(logFile).With().Logger()
ob.fileLogger = &fileLogger
ob.logger.ChainLogger.Info().Msgf("Chain %s endpoint %s", ob.chain.ChainName.String(), evmCfg.Endpoint)
client, err := ethclient.Dial(evmCfg.Endpoint)
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("eth Client Dial")
return nil, err
}
ob.evmClient = client
ob.BlockCache, err = lru.New(1000)
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("failed to create block cache")
return nil, err
}
if ob.chain.IsKlaytnChain() {
client, err := Dial(evmCfg.Endpoint)
if err != nil {
ob.logger.ChainLogger.Err(err).Msg("klaytn Client Dial")
return nil, err
}
ob.KlaytnClient = client
}
// create metric counters
err = ob.RegisterPromCounter("rpc_getLogs_count", "Number of getLogs")
if err != nil {
return nil, err
}
err = ob.RegisterPromCounter("rpc_getBlockByNumber_count", "Number of getBlockByNumber")
if err != nil {
return nil, err
}
err = ob.RegisterPromGauge(metricsPkg.PendingTxs, "Number of pending transactions")
if err != nil {
return nil, err
}
err = ob.LoadDB(dbpath, ob.chain)
if err != nil {
return nil, err
}
ob.logger.ChainLogger.Info().Msgf("%s: start scanning from block %d", ob.chain.String(), ob.GetLastBlockHeightScanned())
return &ob, nil
}
func (ob *EVMChainClient) WithChain(chain common.Chain) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.chain = chain
}
func (ob *EVMChainClient) WithLogger(logger zerolog.Logger) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.logger = EVMLog{
ChainLogger: logger,
ExternalChainWatcher: logger.With().Str("module", "ExternalChainWatcher").Logger(),
WatchGasPrice: logger.With().Str("module", "WatchGasPrice").Logger(),
ObserveOutTx: logger.With().Str("module", "ObserveOutTx").Logger(),
}
}
func (ob *EVMChainClient) WithEvmClient(client *ethclient.Client) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.evmClient = client
}
func (ob *EVMChainClient) WithZetaClient(bridge *ZetaCoreBridge) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.zetaClient = bridge
}
func (ob *EVMChainClient) WithParams(params observertypes.CoreParams) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.params = params
}
func (ob *EVMChainClient) SetConfig(cfg *config.Config) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.cfg = cfg
}
func (ob *EVMChainClient) SetCoreParams(params observertypes.CoreParams) {
ob.Mu.Lock()
defer ob.Mu.Unlock()
ob.params = params
}
func (ob *EVMChainClient) GetCoreParams() observertypes.CoreParams {
ob.Mu.Lock()
defer ob.Mu.Unlock()
return ob.params
}
func (ob *EVMChainClient) GetConnectorContract() (*zetaconnector.ZetaConnectorNonEth, error) {
addr := ethcommon.HexToAddress(ob.GetCoreParams().ConnectorContractAddress)
return FetchConnectorContract(addr, ob.evmClient)
}
func FetchConnectorContract(addr ethcommon.Address, client EVMRPCClient) (*zetaconnector.ZetaConnectorNonEth, error) {
return zetaconnector.NewZetaConnectorNonEth(addr, client)
}
func (ob *EVMChainClient) GetERC20CustodyContract() (*erc20custody.ERC20Custody, error) {
addr := ethcommon.HexToAddress(ob.GetCoreParams().Erc20CustodyContractAddress)
return FetchERC20CustodyContract(addr, ob.evmClient)
}
func FetchERC20CustodyContract(addr ethcommon.Address, client EVMRPCClient) (*erc20custody.ERC20Custody, error) {
return erc20custody.NewERC20Custody(addr, client)
}
func (ob *EVMChainClient) Start() {
go ob.ExternalChainWatcherForNewInboundTrackerSuggestions()
go ob.ExternalChainWatcher() // Observes external Chains for incoming trasnactions
go ob.WatchGasPrice() // Observes external Chains for Gas prices and posts to core
go ob.observeOutTx() // Populates receipts and confirmed outbound transactions
}
func (ob *EVMChainClient) Stop() {
ob.logger.ChainLogger.Info().Msgf("ob %s is stopping", ob.chain.String())
close(ob.stop) // this notifies all goroutines to stop
ob.logger.ChainLogger.Info().Msg("closing ob.db")
dbInst, err := ob.db.DB()
if err != nil {
ob.logger.ChainLogger.Info().Msg("error getting database instance")
}
err = dbInst.Close()
if err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("error closing database")
}
ob.logger.ChainLogger.Info().Msgf("%s observer stopped", ob.chain.String())
}
// returns: isIncluded, isConfirmed, Error
// If isConfirmed, it also post to ZetaCore
func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, cointype common.CoinType, logger zerolog.Logger) (bool, bool, error) {
ob.Mu.Lock()
params := ob.params
receipt, found1 := ob.outTXConfirmedReceipts[ob.GetTxID(nonce)]
transaction, found2 := ob.outTXConfirmedTransaction[ob.GetTxID(nonce)]
ob.Mu.Unlock()
found := found1 && found2
if !found {
return false, false, nil
}
sendID := fmt.Sprintf("%s-%d", ob.chain.String(), nonce)
logger = logger.With().Str("sendID", sendID).Logger()
if cointype == common.CoinType_Cmd {
recvStatus := common.ReceiveStatus_Failed
if receipt.Status == 1 {
recvStatus = common.ReceiveStatus_Success
}
zetaHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
receipt.TxHash.Hex(),
receipt.BlockNumber.Uint64(),
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
transaction.Value(),
recvStatus,
ob.chain,
nonce,
common.CoinType_Cmd,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
return true, true, nil
} else if cointype == common.CoinType_Gas { // the outbound is a regular Ether/BNB/Matic transfer; no need to check events
if receipt.Status == 1 {
zetaHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
receipt.TxHash.Hex(),
receipt.BlockNumber.Uint64(),
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
transaction.Value(),
common.ReceiveStatus_Success,
ob.chain,
nonce,
common.CoinType_Gas,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
return true, true, nil
} else if receipt.Status == 0 { // the same as below events flow
logger.Info().Msgf("Found (failed tx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), receipt.TxHash.Hex())
zetaTxHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
receipt.TxHash.Hex(),
receipt.BlockNumber.Uint64(),
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
big.NewInt(0),
common.ReceiveStatus_Failed,
ob.chain,
nonce,
common.CoinType_Gas,
)
if err != nil {
logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash)
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce)
return true, true, nil
}
} else if cointype == common.CoinType_Zeta { // the outbound is a Zeta transfer; need to check events ZetaReceived
if receipt.Status == 1 {
logs := receipt.Logs
for _, vLog := range logs {
confHeight := vLog.BlockNumber + params.ConfirmationCount
if confHeight < 0 || confHeight >= math.MaxInt64 {
return false, false, fmt.Errorf("confHeight is out of range")
}
// TODO rewrite this to return early if not confirmed
connector, err := ob.GetConnectorContract()
if err != nil {
return false, false, fmt.Errorf("error getting connector contract: %w", err)
}
receivedLog, err := connector.ZetaConnectorNonEthFilterer.ParseZetaReceived(*vLog)
if err == nil {
logger.Info().Msgf("Found (outTx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex())
// #nosec G701 checked in range
if int64(confHeight) < ob.GetLastBlockHeight() {
logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...")
if len(vLog.Topics) != 4 {
logger.Error().Msgf("wrong number of topics in log %d", len(vLog.Topics))
return false, false, fmt.Errorf("wrong number of topics in log %d", len(vLog.Topics))
}
sendhash := vLog.Topics[3].Hex()
//var rxAddress string = ethcommon.HexToAddress(vLog.Topics[1].Hex()).Hex()
mMint := receivedLog.ZetaValue
zetaHash, err := ob.zetaClient.PostReceiveConfirmation(
sendhash,
vLog.TxHash.Hex(),
vLog.BlockNumber,
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
mMint,
common.ReceiveStatus_Success,
ob.chain,
nonce,
common.CoinType_Zeta,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
continue
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
return true, true, nil
}
// #nosec G701 always in range
logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce)
return true, false, nil
}
revertedLog, err := connector.ZetaConnectorNonEthFilterer.ParseZetaReverted(*vLog)
if err == nil {
logger.Info().Msgf("Found (revertTx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex())
// #nosec G701 checked in range
if int64(confHeight) < ob.GetLastBlockHeight() {
logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...")
if len(vLog.Topics) != 3 {
logger.Error().Msgf("wrong number of topics in log %d", len(vLog.Topics))
return false, false, fmt.Errorf("wrong number of topics in log %d", len(vLog.Topics))
}
sendhash := vLog.Topics[2].Hex()
mMint := revertedLog.RemainingZetaValue
metaHash, err := ob.zetaClient.PostReceiveConfirmation(
sendhash,
vLog.TxHash.Hex(),
vLog.BlockNumber,
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
mMint,
common.ReceiveStatus_Success,
ob.chain,
nonce,
common.CoinType_Zeta,
)
if err != nil {
logger.Err(err).Msg("error posting confirmation to meta core")
continue
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", metaHash, sendHash, nonce)
return true, true, nil
}
// #nosec G701 always in range
logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce)
return true, false, nil
}
}
} else if receipt.Status == 0 {
//FIXME: check nonce here by getTransaction RPC
logger.Info().Msgf("Found (failed tx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), receipt.TxHash.Hex())
zetaTxHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
receipt.TxHash.Hex(),
receipt.BlockNumber.Uint64(),
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
big.NewInt(0),
common.ReceiveStatus_Failed,
ob.chain,
nonce,
common.CoinType_Zeta,
)
if err != nil {
logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash)
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce)
return true, true, nil
}
} else if cointype == common.CoinType_ERC20 {
if receipt.Status == 1 {
logs := receipt.Logs
ERC20Custody, err := ob.GetERC20CustodyContract()
if err != nil {
logger.Warn().Msgf("NewERC20Custody err: %s", err)
}
for _, vLog := range logs {
event, err := ERC20Custody.ParseWithdrawn(*vLog)
confHeight := vLog.BlockNumber + params.ConfirmationCount
if confHeight < 0 || confHeight >= math.MaxInt64 {
return false, false, fmt.Errorf("confHeight is out of range")
}
if err == nil {
logger.Info().Msgf("Found (ERC20Custody.Withdrawn Event) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex())
// #nosec G701 checked in range
if int64(confHeight) < ob.GetLastBlockHeight() {
logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...")
zetaHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
vLog.TxHash.Hex(),
vLog.BlockNumber,
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
event.Amount,
common.ReceiveStatus_Success,
ob.chain,
nonce,
common.CoinType_ERC20,
)
if err != nil {
logger.Error().Err(err).Msg("error posting confirmation to meta core")
continue
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce)
return true, true, nil
}
// #nosec G701 always in range
logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce)
return true, false, nil
}
}
} else {
logger.Info().Msgf("Found (failed tx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), receipt.TxHash.Hex())
zetaTxHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
receipt.TxHash.Hex(),
receipt.BlockNumber.Uint64(),
receipt.GasUsed,
transaction.GasPrice(),
transaction.Gas(),
big.NewInt(0),
common.ReceiveStatus_Failed,
ob.chain,
nonce,
common.CoinType_ERC20,
)
if err != nil {
logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash)
}
logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce)
return true, true, nil
}
}
return false, false, nil
}
// The lowest nonce we observe outTx for each chain
var lowestOutTxNonceToObserve = map[int64]uint64{
5: 70000, // Goerli
97: 95000, // BSC testnet
80001: 120000, // Mumbai
}
// FIXME: there's a chance that a txhash in OutTxChan may not deliver when Stop() is called
// observeOutTx periodically checks all the txhash in potential outbound txs
func (ob *EVMChainClient) observeOutTx() {
// read env variables if set
timeoutNonce, err := strconv.Atoi(os.Getenv("OS_TIMEOUT_NONCE"))
if err != nil || timeoutNonce <= 0 {
timeoutNonce = 100 * 3 // process up to 100 hashes
}
rpcRestTime, err := strconv.Atoi(os.Getenv("OS_RPC_REST_TIME"))
if err != nil || rpcRestTime <= 0 {
rpcRestTime = 20 // 20ms
}
ob.logger.ObserveOutTx.Info().Msgf("observeOutTx using timeoutNonce %d seconds, rpcRestTime %d ms", timeoutNonce, rpcRestTime)
ticker := NewDynamicTicker(fmt.Sprintf("EVM_observeOutTx_%d", ob.chain.ChainId), ob.GetCoreParams().OutTxTicker)
defer ticker.Stop()
for {
select {
case <-ticker.C():
trackers, err := ob.zetaClient.GetAllOutTxTrackerByChain(ob.chain, Ascending)
if err != nil {
continue
}
sort.Slice(trackers, func(i, j int) bool {
return trackers[i].Nonce < trackers[j].Nonce
})
outTimeout := time.After(time.Duration(timeoutNonce) * time.Second)
TRACKERLOOP:
// Skip old gabbage trackers as we spent too much time on querying them
for _, tracker := range trackers {
nonceInt := tracker.Nonce
if nonceInt < lowestOutTxNonceToObserve[ob.chain.ChainId] {
continue
}
TXHASHLOOP:
for _, txHash := range tracker.HashList {
//inTimeout := time.After(3000 * time.Millisecond)
select {
case <-outTimeout:
ob.logger.ObserveOutTx.Warn().Msgf("observeOutTx timeout on chain %d nonce %d", ob.chain.ChainId, nonceInt)
break TRACKERLOOP
default:
ob.Mu.Lock()
_, found := ob.outTXConfirmedReceipts[ob.GetTxID(nonceInt)]
ob.Mu.Unlock()
if found {
continue
}
receipt, transaction, err := ob.queryTxByHash(txHash.TxHash, nonceInt)
time.Sleep(time.Duration(rpcRestTime) * time.Millisecond)
if err == nil && receipt != nil { // confirmed
ob.Mu.Lock()
ob.outTXConfirmedReceipts[ob.GetTxID(nonceInt)] = receipt
ob.outTXConfirmedTransaction[ob.GetTxID(nonceInt)] = transaction
ob.Mu.Unlock()
break TXHASHLOOP
}
if err != nil {
ob.logger.ObserveOutTx.Debug().Err(err).Msgf("error queryTxByHash: chain %s hash %s", ob.chain.String(), txHash.TxHash)
}
//<-inTimeout
}
}
}
ticker.UpdateInterval(ob.GetCoreParams().OutTxTicker, ob.logger.ObserveOutTx)
case <-ob.stop:
ob.logger.ObserveOutTx.Info().Msg("observeOutTx: stopped")
return
}
}
}
// return the status of txHash
// receipt nil, err non-nil: txHash not found
// receipt nil, err nil: txHash receipt recorded, but may not be confirmed
// receipt non-nil, err nil: txHash confirmed
func (ob *EVMChainClient) queryTxByHash(txHash string, nonce uint64) (*ethtypes.Receipt, *ethtypes.Transaction, error) {
logger := ob.logger.ObserveOutTx.With().Str("txHash", txHash).Uint64("nonce", nonce).Logger()
if ob.outTXConfirmedReceipts[ob.GetTxID(nonce)] != nil && ob.outTXConfirmedTransaction[ob.GetTxID(nonce)] != nil {
return nil, nil, fmt.Errorf("queryTxByHash: txHash %s receipts already recorded", txHash)
}
ctxt, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
receipt, err := ob.evmClient.TransactionReceipt(ctxt, ethcommon.HexToHash(txHash))
if err != nil {
if err != ethereum.NotFound {
logger.Warn().Err(err).Msg("TransactionReceipt/TransactionByHash error")
}
return nil, nil, err
}
transaction, _, err := ob.evmClient.TransactionByHash(ctxt, ethcommon.HexToHash(txHash))
if err != nil {
return nil, nil, err
}
if transaction.Nonce() != nonce {
return nil, nil, fmt.Errorf("queryTxByHash: txHash %s nonce mismatch: wanted %d, got tx nonce %d", txHash, nonce, transaction.Nonce())
}
confHeight := receipt.BlockNumber.Uint64() + ob.GetCoreParams().ConfirmationCount
if confHeight < 0 || confHeight >= math.MaxInt64 {
return nil, nil, fmt.Errorf("confHeight is out of range")
}
// #nosec G701 checked in range
if int64(confHeight) > ob.GetLastBlockHeight() {
log.Warn().Msgf("included but not confirmed: receipt block %d, current block %d", receipt.BlockNumber, ob.GetLastBlockHeight())
return nil, nil, fmt.Errorf("included but not confirmed")
}
return receipt, transaction, nil
}
// SetLastBlockHeightScanned set last block height scanned (not necessarily caught up with external block; could be slow/paused)
func (ob *EVMChainClient) SetLastBlockHeightScanned(block int64) {
if block < 0 {
panic("lastBlockScanned is negative")
}
if block >= math.MaxInt64 {
panic("lastBlockScanned is too large")
}
atomic.StoreInt64(&ob.lastBlockScanned, block)
ob.ts.SetLastScannedBlockNumber(ob.chain.ChainId, block)
}
// GetLastBlockHeightScanned get last block height scanned (not necessarily caught up with external block; could be slow/paused)
func (ob *EVMChainClient) GetLastBlockHeightScanned() int64 {
height := atomic.LoadInt64(&ob.lastBlockScanned)
if height < 0 {
panic("lastBlockScanned is negative")
}
if height >= math.MaxInt64 {
panic("lastBlockScanned is too large")
}
return height
}
// SetLastBlockHeight set external last block height (confirmed with confirmation count)
func (ob *EVMChainClient) SetLastBlockHeight(block int64) {
if block < 0 {
panic("lastBlock is negative")
}
if block >= math.MaxInt64 {
panic("lastBlock is too large")
}
atomic.StoreInt64(&ob.lastBlock, block)
}
// GetLastBlockHeight get external last block height (confirmed with confirmation count)
func (ob *EVMChainClient) GetLastBlockHeight() int64 {
height := atomic.LoadInt64(&ob.lastBlock)
if height < 0 {
panic("lastBlock is negative")
}
if height >= math.MaxInt64 {
panic("lastBlock is too large")
}
return height
}
func (ob *EVMChainClient) ExternalChainWatcher() {
// At each tick, query the Connector contract
ticker := NewDynamicTicker(fmt.Sprintf("EVM_ExternalChainWatcher_%d", ob.chain.ChainId), ob.GetCoreParams().InTxTicker)
defer ticker.Stop()
ob.logger.ExternalChainWatcher.Info().Msg("ExternalChainWatcher started")
for {
select {
case <-ticker.C():
err := ob.observeInTX()
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("observeInTX error")
}
ticker.UpdateInterval(ob.GetCoreParams().InTxTicker, ob.logger.ExternalChainWatcher)
case <-ob.stop:
ob.logger.ExternalChainWatcher.Info().Msg("ExternalChainWatcher stopped")
return
}
}
}
func (ob *EVMChainClient) observeInTX() error {
header, err := ob.evmClient.HeaderByNumber(context.Background(), nil)
if err != nil {
return err
}
// "confirmed" current block number
confirmedBlockNum := header.Number.Uint64() - ob.GetCoreParams().ConfirmationCount
// #nosec G701 always in range
ob.SetLastBlockHeight(int64(confirmedBlockNum))
crosschainFlags, err := ob.zetaClient.GetCrosschainFlags()
if err != nil {
return err
}
if !crosschainFlags.IsInboundEnabled {
return errors.New("inbound TXS / Send has been disabled by the protocol")
}
counter, err := ob.GetPromCounter("rpc_getBlockByNumber_count")
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("GetPromCounter:")
}
counter.Inc()
// skip if no new block is produced.
sampledLogger := ob.logger.ExternalChainWatcher.Sample(&zerolog.BasicSampler{N: 10})
if confirmedBlockNum < 0 || confirmedBlockNum > math.MaxUint64 {
sampledLogger.Error().Msg("Skipping observer , confirmedBlockNum is negative or too large ")
return nil
}
// #nosec G701 checked in range
if confirmedBlockNum <= uint64(ob.GetLastBlockHeightScanned()) {
sampledLogger.Debug().Msg("Skipping observer , No new block is produced ")
return nil
}
lastBlock := ob.GetLastBlockHeightScanned()
startBlock := lastBlock + 1
toBlock := lastBlock + config.MaxBlocksPerPeriod // read at most 10 blocks in one go
// #nosec G701 always positive
if uint64(toBlock) >= confirmedBlockNum {
// #nosec G701 checked in range
toBlock = int64(confirmedBlockNum)
}
if startBlock < 0 || startBlock >= math.MaxInt64 {
return fmt.Errorf("startBlock is negative or too large")
}
if toBlock < 0 || toBlock >= math.MaxInt64 {
return fmt.Errorf("toBlock is negative or too large")
}
ob.logger.ExternalChainWatcher.Info().Msgf("Checking for all inTX : startBlock %d, toBlock %d", startBlock, toBlock)
//task 1: Query evm chain for zeta sent logs
func() {
// #nosec G701 always positive
tb := uint64(toBlock)
connector, err := ob.GetConnectorContract()
if err != nil {
ob.logger.ChainLogger.Warn().Err(err).Msgf("observeInTx: GetConnectorContract error:")
return
}
cnt, err := ob.GetPromCounter("rpc_getLogs_count")
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("GetPromCounter:")
} else {
cnt.Inc()
}
logs, err := connector.FilterZetaSent(&bind.FilterOpts{
// #nosec G701 always positive
Start: uint64(startBlock),
End: &tb,
Context: context.TODO(),
}, []ethcommon.Address{}, []*big.Int{})
if err != nil {
ob.logger.ChainLogger.Warn().Err(err).Msgf("observeInTx: FilterZetaSent error:")
return
}
// Pull out arguments from logs
for logs.Next() {
msg, err := ob.GetInboundVoteMsgForZetaSentEvent(logs.Event)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error getting inbound vote msg")
continue
}
zetaHash, err := ob.zetaClient.PostSend(PostSendNonEVMGasLimit, &msg)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
return
}
ob.logger.ExternalChainWatcher.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
}
}()
// task 2: Query evm chain for deposited logs
func() {
// #nosec G701 always positive
toB := uint64(toBlock)
erc20custody, err := ob.GetERC20CustodyContract()
if err != nil {
ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("observeInTx: GetERC20CustodyContract error:")
return
}
depositedLogs, err := erc20custody.FilterDeposited(&bind.FilterOpts{
// #nosec G701 always positive
Start: uint64(startBlock),
End: &toB,
Context: context.TODO(),
}, []ethcommon.Address{})
if err != nil {
ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("observeInTx: FilterDeposited error:")
return
}
cnt, err := ob.GetPromCounter("rpc_getLogs_count")
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("GetPromCounter:")
} else {
cnt.Inc()
}
// Pull out arguments from logs
for depositedLogs.Next() {
msg, err := ob.GetInboundVoteMsgForDepositedEvent(depositedLogs.Event)
if err != nil {
continue
}
zetaHash, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, &msg)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
return
}
ob.logger.ExternalChainWatcher.Info().Msgf("ZRC20Custody Deposited event detected and reported: PostSend zeta tx: %s", zetaHash)
}
}()
// task 3: query the incoming tx to TSS address ==============
func() {
tssAddress := ob.Tss.EVMAddress() // after keygen, ob.Tss.pubkey will be updated
if tssAddress == (ethcommon.Address{}) {
ob.logger.ExternalChainWatcher.Warn().Msgf("observeInTx: TSS address not set")
return
}
// query incoming gas asset
if !ob.chain.IsKlaytnChain() {
for bn := startBlock; bn <= toBlock; bn++ {
block, err := ob.GetBlockByNumberCached(bn)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error getting block: %d", bn)
continue
}
headerRLP, err := rlp.EncodeToBytes(block.Header())
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error encoding block header: %d", bn)
continue
}
_, err = ob.zetaClient.PostAddBlockHeader(
ob.chain.ChainId,
block.Hash().Bytes(),
block.Number().Int64(),
common.NewEthereumHeader(headerRLP),
)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error posting block header: %d", bn)
continue
}
for _, tx := range block.Transactions() {
if tx.To() == nil {
continue
}
if bytes.Compare(tx.Data(), []byte(DonationMessage)) == 0 {
ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation!: %s", tx.Hash().Hex())
continue
}
if *tx.To() == tssAddress {
receipt, err := ob.evmClient.TransactionReceipt(context.Background(), tx.Hash())
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("TransactionReceipt error")
continue
}
if receipt.Status != 1 { // 1: successful, 0: failed
ob.logger.ExternalChainWatcher.Info().Msgf("tx %s failed; don't act", tx.Hash())
continue
}
from, err := ob.evmClient.TransactionSender(context.Background(), tx, block.Hash(), receipt.TransactionIndex)
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("TransactionSender error; trying local recovery (assuming LondonSigner dynamic fee tx type) of sender address")
signer := ethtypes.NewLondonSigner(big.NewInt(ob.chain.ChainId))
from, err = signer.Sender(tx)
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("local recovery of sender address failed")
continue
}
}
msg := ob.GetInboundVoteMsgForTokenSentToTSS(tx.Hash(), tx.Value(), receipt, from, tx.Data())
if msg == nil {
continue
}
zetaHash, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, msg)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
continue
}
ob.logger.ExternalChainWatcher.Info().Msgf("Gas Deposit detected and reported: PostSend zeta tx: %s", zetaHash)
}
}
}
} else { // for Klaytn
for bn := startBlock; bn <= toBlock; bn++ {
//block, err := ob.EvmClient.BlockByNumber(context.Background(), big.NewInt(int64(bn)))
block, err := ob.KlaytnClient.BlockByNumber(context.Background(), big.NewInt(bn))
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error getting block: %d", bn)
continue
}
for _, tx := range block.Transactions {
if tx.To == nil {
continue
}
if *tx.To == tssAddress {
receipt, err := ob.evmClient.TransactionReceipt(context.Background(), tx.Hash)
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("TransactionReceipt error")
continue
}
if receipt.Status != 1 { // 1: successful, 0: failed
ob.logger.ExternalChainWatcher.Info().Msgf("tx %s failed; don't act", tx.Hash.Hex())
continue
}
from := *tx.From
value := tx.Value.ToInt()
msg := ob.GetInboundVoteMsgForTokenSentToTSS(tx.Hash, value, receipt, from, tx.Input)
if msg == nil {
continue
}
zetaHash, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, msg)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
continue
}
ob.logger.ExternalChainWatcher.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
}
}
}
}
}()
// ============= end of query the incoming tx to TSS address ==============
ob.SetLastBlockHeightScanned(toBlock)
if err := ob.db.Save(clienttypes.ToLastBlockSQLType(ob.GetLastBlockHeightScanned())).Error; err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error writing toBlock to db")
}
return nil
}
func (ob *EVMChainClient) WatchGasPrice() {
err := ob.PostGasPrice()
if err != nil {
height, err := ob.zetaClient.GetBlockHeight()
if err != nil {
ob.logger.WatchGasPrice.Error().Err(err).Msg("GetBlockHeight error")
} else {
ob.logger.WatchGasPrice.Error().Err(err).Msgf("PostGasPrice error at zeta block : %d ", height)
}
}
ticker := NewDynamicTicker(fmt.Sprintf("EVM_WatchGasPrice_%d", ob.chain.ChainId), ob.GetCoreParams().GasPriceTicker)
defer ticker.Stop()
for {
select {
case <-ticker.C():
err := ob.PostGasPrice()
if err != nil {
height, err := ob.zetaClient.GetBlockHeight()
if err != nil {
ob.logger.WatchGasPrice.Error().Err(err).Msg("GetBlockHeight error")
} else {
ob.logger.WatchGasPrice.Error().Err(err).Msgf("PostGasPrice error at zeta block : %d ", height)
}
}
ticker.UpdateInterval(ob.GetCoreParams().GasPriceTicker, ob.logger.WatchGasPrice)
case <-ob.stop:
ob.logger.WatchGasPrice.Info().Msg("WatchGasPrice stopped")
return
}
}
}
func (ob *EVMChainClient) PostGasPrice() error {
// GAS PRICE
gasPrice, err := ob.evmClient.SuggestGasPrice(context.TODO())
if err != nil {
ob.logger.WatchGasPrice.Err(err).Msg("Err SuggestGasPrice:")
return err
}
blockNum, err := ob.evmClient.BlockNumber(context.TODO())
if err != nil {
ob.logger.WatchGasPrice.Err(err).Msg("Err Fetching Most recent Block : ")
return err
}
// SUPPLY
var supply string // lockedAmount on ETH, totalSupply on other chains
supply = "100"
zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, gasPrice.Uint64(), supply, blockNum)
if err != nil {
ob.logger.WatchGasPrice.Err(err).Msg("PostGasPrice to zetacore failed")
return err
}
_ = zetaHash
//ob.logger.WatchGasPrice.Debug().Msgf("PostGasPrice zeta tx: %s", zetaHash)
return nil
}
// query ZetaCore about the last block that it has heard from a specific chain.
// return 0 if not existent.
func (ob *EVMChainClient) getLastHeight() (int64, error) {
lastheight, err := ob.zetaClient.GetLastBlockHeightByChain(ob.chain)
if err != nil {
return 0, errors.Wrap(err, "getLastHeight")
}
// #nosec G701 always in range
return int64(lastheight.LastSendHeight), nil
}
func (ob *EVMChainClient) BuildBlockIndex() error {
logger := ob.logger.ChainLogger.With().Str("module", "BuildBlockIndex").Logger()
envvar := ob.chain.ChainName.String() + "_SCAN_FROM"
scanFromBlock := os.Getenv(envvar)
if scanFromBlock != "" {
logger.Info().Msgf("envvar %s is set; scan from block %s", envvar, scanFromBlock)
if scanFromBlock == clienttypes.EnvVarLatest {
header, err := ob.evmClient.HeaderByNumber(context.Background(), nil)
if err != nil {
return err
}
ob.SetLastBlockHeightScanned(header.Number.Int64())
} else {
scanFromBlockInt, err := strconv.ParseInt(scanFromBlock, 10, 64)
if err != nil {
return err
}
ob.SetLastBlockHeightScanned(scanFromBlockInt)
}
} else { // last observed block
var lastBlockNum clienttypes.LastBlockSQLType
if err := ob.db.First(&lastBlockNum, clienttypes.LastBlockNumID).Error; err != nil {
logger.Info().Msg("db PosKey does not exist; read from ZetaCore")
lastheight, err := ob.getLastHeight()
if err != nil {
logger.Warn().Err(err).Msg("getLastHeight error")
}
ob.SetLastBlockHeightScanned(lastheight)
// if ZetaCore does not have last heard block height, then use current
if ob.GetLastBlockHeightScanned() == 0 {
header, err := ob.evmClient.HeaderByNumber(context.Background(), nil)
if err != nil {
return err
}
ob.SetLastBlockHeightScanned(header.Number.Int64())
}
if dbc := ob.db.Save(clienttypes.ToLastBlockSQLType(ob.GetLastBlockHeightScanned())); dbc.Error != nil {
logger.Error().Err(dbc.Error).Msg("error writing ob.LastBlock to db: ")
}
} else {
ob.SetLastBlockHeightScanned(lastBlockNum.Num)
}
}
return nil
}
func (ob *EVMChainClient) BuildReceiptsMap() error {
logger := ob.logger
var receipts []clienttypes.ReceiptSQLType
if err := ob.db.Find(&receipts).Error; err != nil {
logger.ChainLogger.Error().Err(err).Msg("error iterating over db")
return err
}
for _, receipt := range receipts {
r, err := clienttypes.FromReceiptDBType(receipt.Receipt)
if err != nil {
return err
}
ob.outTXConfirmedReceipts[receipt.Identifier] = r
}
return nil
}
func (ob *EVMChainClient) BuildTransactionsMap() error {
logger := ob.logger
var transactions []clienttypes.TransactionSQLType
if err := ob.db.Find(&transactions).Error; err != nil {
logger.ChainLogger.Error().Err(err).Msg("error iterating over db")
return err
}
for _, transaction := range transactions {
trans, err := clienttypes.FromTransactionDBType(transaction.Transaction)
if err != nil {
return err
}
ob.outTXConfirmedTransaction[transaction.Identifier] = trans
}
return nil
}
// LoadDB open sql database and load data into EVMChainClient
func (ob *EVMChainClient) LoadDB(dbPath string, chain common.Chain) error {
if dbPath != "" {
if _, err := os.Stat(dbPath); os.IsNotExist(err) {
err := os.MkdirAll(dbPath, os.ModePerm)
if err != nil {
return err
}
}
path := fmt.Sprintf("%s/%s", dbPath, chain.ChainName.String()) //Use "file::memory:?cache=shared" for temp db
db, err := gorm.Open(sqlite.Open(path), &gorm.Config{})
if err != nil {
panic("failed to connect database")
}
err = db.AutoMigrate(&clienttypes.ReceiptSQLType{},
&clienttypes.TransactionSQLType{},
&clienttypes.LastBlockSQLType{})
if err != nil {
return err
}
ob.db = db
err = ob.BuildBlockIndex()
if err != nil {
return err
}
//DISABLING RECEIPT AND TRANSACTION PERSISTENCE
//err = ob.BuildReceiptsMap()
//if err != nil {
// return err
//}
//
//err = ob.BuildTransactionsMap()
//if err != nil {
// return err
//}
}
return nil
}
func (ob *EVMChainClient) SetMinAndMaxNonce(trackers []types.OutTxTracker) error {
minNonce, maxNonce := int64(-1), int64(0)
for _, tracker := range trackers {
conv := tracker.Nonce
// #nosec G701 always in range
intNonce := int64(conv)
if minNonce == -1 {
minNonce = intNonce
}
if intNonce < minNonce {
minNonce = intNonce
}
if intNonce > maxNonce {
maxNonce = intNonce
}
}
if minNonce != -1 {
atomic.StoreInt64(&ob.MinNonce, minNonce)
}
if maxNonce > 0 {
atomic.StoreInt64(&ob.MaxNonce, maxNonce)
}
return nil
}
func (ob *EVMChainClient) GetTxID(nonce uint64) string {
tssAddr := ob.Tss.EVMAddress().String()
return fmt.Sprintf("%d-%s-%d", ob.chain.ChainId, tssAddr, nonce)
}
func (ob *EVMChainClient) GetBlockByNumberCached(blockNumber int64) (*ethtypes.Block, error) {
if block, ok := ob.BlockCache.Get(blockNumber); ok {
return block.(*ethtypes.Block), nil
}
block, err := ob.evmClient.BlockByNumber(context.Background(), big.NewInt(blockNumber))
if err != nil {
return nil, err
}
ob.BlockCache.Add(blockNumber, block)
ob.BlockCache.Add(block.Hash(), block)
return block, nil
}
package zetaclient
import (
"context"
"encoding/base64"
"encoding/hex"
"fmt"
"math/big"
"math/rand"
"strconv"
"strings"
"time"
"github.com/ethereum/go-ethereum/accounts/abi"
ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)
type EVMSigner struct {
client EVMRPCClient
chain *common.Chain
chainID *big.Int
tssSigner TSSSigner
ethSigner ethtypes.Signer
abi abi.ABI
erc20CustodyABI abi.ABI
metaContractAddress ethcommon.Address
erc20CustodyContractAddress ethcommon.Address
logger zerolog.Logger
ts *TelemetryServer
}
var _ ChainSigner = &EVMSigner{}
func NewEVMSigner(
chain common.Chain,
endpoint string,
tssSigner TSSSigner,
abiString string,
erc20CustodyABIString string,
metaContract ethcommon.Address,
erc20CustodyContract ethcommon.Address,
logger zerolog.Logger,
ts *TelemetryServer,
) (*EVMSigner, error) {
client, err := ethclient.Dial(endpoint)
if err != nil {
return nil, err
}
chainID, err := client.ChainID(context.TODO())
if err != nil {
return nil, err
}
ethSigner := ethtypes.LatestSignerForChainID(chainID)
connectorABI, err := abi.JSON(strings.NewReader(abiString))
if err != nil {
return nil, err
}
erc20CustodyABI, err := abi.JSON(strings.NewReader(erc20CustodyABIString))
if err != nil {
return nil, err
}
return &EVMSigner{
client: client,
chain: &chain,
tssSigner: tssSigner,
chainID: chainID,
ethSigner: ethSigner,
abi: connectorABI,
erc20CustodyABI: erc20CustodyABI,
metaContractAddress: metaContract,
erc20CustodyContractAddress: erc20CustodyContract,
logger: logger.With().
Str("chain", chain.ChainName.String()).
Str("module", "EVMSigner").Logger(),
ts: ts,
}, nil
}
// Sign given data, and metadata (gas, nonce, etc)
// returns a signed transaction, sig bytes, hash bytes, and error
func (signer *EVMSigner) Sign(
data []byte,
to ethcommon.Address,
gasLimit uint64,
gasPrice *big.Int,
nonce uint64,
height uint64,
) (*ethtypes.Transaction, []byte, []byte, error) {
log.Debug().Msgf("TSS SIGNER: %s", signer.tssSigner.Pubkey())
tx := ethtypes.NewTransaction(nonce, to, big.NewInt(0), gasLimit, gasPrice, data)
hashBytes := signer.ethSigner.Hash(tx).Bytes()
sig, err := signer.tssSigner.Sign(hashBytes, height, nonce, signer.chain, "")
if err != nil {
return nil, nil, nil, err
}
log.Debug().Msgf("Sign: Signature: %s", hex.EncodeToString(sig[:]))
pubk, err := crypto.SigToPub(hashBytes, sig[:])
if err != nil {
signer.logger.Error().Err(err).Msgf("SigToPub error")
}
addr := crypto.PubkeyToAddress(*pubk)
signer.logger.Info().Msgf("Sign: Ecrecovery of signature: %s", addr.Hex())
signedTX, err := tx.WithSignature(signer.ethSigner, sig[:])
if err != nil {
return nil, nil, nil, err
}
return signedTX, sig[:], hashBytes[:], nil
}
// Broadcast takes in signed tx, broadcast to external chain node
func (signer *EVMSigner) Broadcast(tx *ethtypes.Transaction) error {
ctxt, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
return signer.client.SendTransaction(ctxt, tx)
}
// SignOutboundTx
// function onReceive(
//
// bytes calldata originSenderAddress,
// uint256 originChainId,
// address destinationAddress,
// uint zetaAmount,
// bytes calldata message,
// bytes32 internalSendHash
//
// ) external virtual {}
func (signer *EVMSigner) SignOutboundTx(sender ethcommon.Address,
srcChainID *big.Int,
to ethcommon.Address,
amount *big.Int,
gasLimit uint64,
message []byte,
sendHash [32]byte,
nonce uint64,
gasPrice *big.Int,
height uint64) (*ethtypes.Transaction, error) {
if len(sendHash) < 32 {
return nil, fmt.Errorf("sendHash len %d must be 32", len(sendHash))
}
var data []byte
var err error
data, err = signer.abi.Pack("onReceive", sender.Bytes(), srcChainID, to, amount, message, sendHash)
if err != nil {
return nil, fmt.Errorf("pack error: %w", err)
}
tx, _, _, err := signer.Sign(data, signer.metaContractAddress, gasLimit, gasPrice, nonce, height)
if err != nil {
return nil, fmt.Errorf("Sign error: %w", err)
}
return tx, nil
}
// SignRevertTx
// function onRevert(
// address originSenderAddress,
// uint256 originChainId,
// bytes calldata destinationAddress,
// uint256 destinationChainId,
// uint256 zetaAmount,
// bytes calldata message,
// bytes32 internalSendHash
// ) external override whenNotPaused onlyTssAddress
func (signer *EVMSigner) SignRevertTx(
sender ethcommon.Address,
srcChainID *big.Int,
to []byte,
toChainID *big.Int,
amount *big.Int,
gasLimit uint64,
message []byte,
sendHash [32]byte,
nonce uint64,
gasPrice *big.Int,
height uint64,
) (*ethtypes.Transaction, error) {
var data []byte
var err error
data, err = signer.abi.Pack("onRevert", sender, srcChainID, to, toChainID, amount, message, sendHash)
if err != nil {
return nil, fmt.Errorf("pack error: %w", err)
}
tx, _, _, err := signer.Sign(data, signer.metaContractAddress, gasLimit, gasPrice, nonce, height)
if err != nil {
return nil, fmt.Errorf("Sign error: %w", err)
}
return tx, nil
}
func (signer *EVMSigner) SignCancelTx(nonce uint64, gasPrice *big.Int, height uint64) (*ethtypes.Transaction, error) {
tx := ethtypes.NewTransaction(nonce, signer.tssSigner.EVMAddress(), big.NewInt(0), 21000, gasPrice, nil)
hashBytes := signer.ethSigner.Hash(tx).Bytes()
sig, err := signer.tssSigner.Sign(hashBytes, height, nonce, signer.chain, "")
if err != nil {
return nil, err
}
pubk, err := crypto.SigToPub(hashBytes, sig[:])
if err != nil {
signer.logger.Error().Err(err).Msgf("SigToPub error")
}
addr := crypto.PubkeyToAddress(*pubk)
signer.logger.Info().Msgf("Sign: Ecrecovery of signature: %s", addr.Hex())
signedTX, err := tx.WithSignature(signer.ethSigner, sig[:])
if err != nil {
return nil, err
}
return signedTX, nil
}
func (signer *EVMSigner) SignWithdrawTx(
to ethcommon.Address,
amount *big.Int,
nonce uint64,
gasPrice *big.Int,
height uint64,
) (*ethtypes.Transaction, error) {
tx := ethtypes.NewTransaction(nonce, to, amount, 21000, gasPrice, nil)
hashBytes := signer.ethSigner.Hash(tx).Bytes()
sig, err := signer.tssSigner.Sign(hashBytes, height, nonce, signer.chain, "")
if err != nil {
return nil, err
}
pubk, err := crypto.SigToPub(hashBytes, sig[:])
if err != nil {
signer.logger.Error().Err(err).Msgf("SigToPub error")
}
addr := crypto.PubkeyToAddress(*pubk)
signer.logger.Info().Msgf("Sign: Ecrecovery of signature: %s", addr.Hex())
signedTX, err := tx.WithSignature(signer.ethSigner, sig[:])
if err != nil {
return nil, err
}
return signedTX, nil
}
func (signer *EVMSigner) SignCommandTx(
cmd string,
params string,
to ethcommon.Address,
outboundParams *types.OutboundTxParams,
gasLimit uint64,
gasPrice *big.Int,
height uint64,
) (*ethtypes.Transaction, error) {
if cmd == common.CmdWhitelistERC20 {
erc20 := ethcommon.HexToAddress(params)
if erc20 == (ethcommon.Address{}) {
return nil, fmt.Errorf("SignCommandTx: invalid erc20 address %s", params)
}
custodyAbi, err := erc20custody.ERC20CustodyMetaData.GetAbi()
if err != nil {
return nil, err
}
data, err := custodyAbi.Pack("whitelist", erc20)
if err != nil {
return nil, err
}
tx, _, _, err := signer.Sign(data, to, gasLimit, gasPrice, outboundParams.OutboundTxTssNonce, height)
if err != nil {
return nil, fmt.Errorf("sign error: %w", err)
}
return tx, nil
}
if cmd == common.CmdMigrateTssFunds {
tx := ethtypes.NewTransaction(outboundParams.OutboundTxTssNonce, to, outboundParams.Amount.BigInt(), 21000, gasPrice, nil)
hashBytes := signer.ethSigner.Hash(tx).Bytes()
sig, err := signer.tssSigner.Sign(hashBytes, height, outboundParams.OutboundTxTssNonce, signer.chain, "")
if err != nil {
return nil, err
}
pubk, err := crypto.SigToPub(hashBytes, sig[:])
if err != nil {
signer.logger.Error().Err(err).Msgf("SigToPub error")
}
addr := crypto.PubkeyToAddress(*pubk)
signer.logger.Info().Msgf("Sign: Ecrecovery of signature: %s", addr.Hex())
signedTX, err := tx.WithSignature(signer.ethSigner, sig[:])
if err != nil {
return nil, err
}
return signedTX, nil
}
return nil, fmt.Errorf("SignCommandTx: unknown command %s", cmd)
}
func (signer *EVMSigner) TryProcessOutTx(
send *types.CrossChainTx,
outTxMan *OutTxProcessorManager,
outTxID string,
evmClient ChainClient,
zetaBridge ZetaCoreBridger,
height uint64,
) {
logger := signer.logger.With().
Str("outTxID", outTxID).
Str("SendHash", send.Index).
Logger()
logger.Info().Msgf("start processing outTxID %s", outTxID)
logger.Info().Msgf("EVM Chain TryProcessOutTx: %s, value %d to %s", send.Index, send.GetCurrentOutTxParam().Amount.BigInt(), send.GetCurrentOutTxParam().Receiver)
defer func() {
outTxMan.EndTryProcess(outTxID)
}()
myID := zetaBridge.GetKeys().GetOperatorAddress()
var to ethcommon.Address
var err error
var toChain *common.Chain
if send.CctxStatus.Status == types.CctxStatus_PendingRevert {
to = ethcommon.HexToAddress(send.InboundTxParams.Sender)
toChain = common.GetChainFromChainID(send.InboundTxParams.SenderChainId)
if toChain == nil {
logger.Error().Msgf("Unknown chain: %d", send.InboundTxParams.SenderChainId)
return
}
logger.Info().Msgf("Abort: reverting inbound")
} else if send.CctxStatus.Status == types.CctxStatus_PendingOutbound {
to = ethcommon.HexToAddress(send.GetCurrentOutTxParam().Receiver)
toChain = common.GetChainFromChainID(send.GetCurrentOutTxParam().ReceiverChainId)
if toChain == nil {
logger.Error().Msgf("Unknown chain: %d", send.GetCurrentOutTxParam().ReceiverChainId)
return
}
} else {
logger.Info().Msgf("Transaction doesn't need to be processed status: %d", send.CctxStatus.Status)
return
}
if err != nil {
logger.Error().Err(err).Msg("ParseChain fail; skip")
return
}
// Early return if the cctx is already processed
included, confirmed, err := evmClient.IsSendOutTxProcessed(send.Index, send.GetCurrentOutTxParam().OutboundTxTssNonce, send.GetCurrentOutTxParam().CoinType, logger)
if err != nil {
logger.Error().Err(err).Msg("IsSendOutTxProcessed failed")
}
if included || confirmed {
logger.Info().Msgf("CCTX already processed; exit signer")
return
}
var message []byte
if send.GetCurrentOutTxParam().CoinType != common.CoinType_Cmd {
message, err = base64.StdEncoding.DecodeString(send.RelayedMessage)
if err != nil {
logger.Err(err).Msgf("decode CCTX.Message %s error", send.RelayedMessage)
}
}
gasLimit := send.GetCurrentOutTxParam().OutboundTxGasLimit
if gasLimit < 100_000 {
gasLimit = 100_000
logger.Warn().Msgf("gasLimit %d is too low; set to %d", send.GetCurrentOutTxParam().OutboundTxGasLimit, gasLimit)
}
if gasLimit > 1_000_000 {
gasLimit = 1_000_000
logger.Warn().Msgf("gasLimit %d is too high; set to %d", send.GetCurrentOutTxParam().OutboundTxGasLimit, gasLimit)
}
logger.Info().Msgf("chain %s minting %d to %s, nonce %d, finalized zeta bn %d", toChain, send.InboundTxParams.Amount, to.Hex(), send.GetCurrentOutTxParam().OutboundTxTssNonce, send.InboundTxParams.InboundTxFinalizedZetaHeight)
sendHash, err := hex.DecodeString(send.Index[2:]) // remove the leading 0x
if err != nil || len(sendHash) != 32 {
logger.Error().Err(err).Msgf("decode CCTX %s error", send.Index)
return
}
var sendhash [32]byte
copy(sendhash[:32], sendHash[:32])
// use dynamic gas price for ethereum chains
var gasprice *big.Int
// The code below is a fix for https://github.com/zeta-chain/node/issues/1085
// doesn't close directly the issue because we should determine if we want to keep using SuggestGasPrice if no OutboundTxGasPrice
// we should possibly remove it completely and return an error if no OutboundTxGasPrice is provided because it means no fee is processed on ZetaChain
specified, ok := new(big.Int).SetString(send.GetCurrentOutTxParam().OutboundTxGasPrice, 10)
if !ok {
if common.IsEthereumChain(toChain.ChainId) {
suggested, err := signer.client.SuggestGasPrice(context.Background())
if err != nil {
logger.Error().Err(err).Msgf("cannot get gas price from chain %s ", toChain)
return
}
gasprice = roundUpToNearestGwei(suggested)
} else {
logger.Error().Err(err).Msgf("cannot convert gas price %s ", send.GetCurrentOutTxParam().OutboundTxGasPrice)
return
}
} else {
gasprice = specified
}
//if common.IsEthereumChain(toChain.ChainId) {
// suggested, err := signer.client.SuggestGasPrice(context.Background())
// if err != nil {
// logger.Error().Err(err).Msgf("cannot get gas price from chain %s ", toChain)
// return
// }
// gasprice = roundUpToNearestGwei(suggested)
//} else {
// specified, ok := new(big.Int).SetString(send.GetCurrentOutTxParam().OutboundTxGasPrice, 10)
// if !ok {
// logger.Error().Err(err).Msgf("cannot convert gas price %s ", send.GetCurrentOutTxParam().OutboundTxGasPrice)
// return
// }
// gasprice = specified
//}
flags, err := zetaBridge.GetCrosschainFlags()
if err != nil {
logger.Error().Err(err).Msgf("cannot get crosschain flags")
return
}
var tx *ethtypes.Transaction
if send.GetCurrentOutTxParam().CoinType == common.CoinType_Cmd { // admin command
to := ethcommon.HexToAddress(send.GetCurrentOutTxParam().Receiver)
if to == (ethcommon.Address{}) {
logger.Error().Msgf("invalid receiver %s", send.GetCurrentOutTxParam().Receiver)
return
}
msg := strings.Split(send.RelayedMessage, ":")
if len(msg) != 2 {
logger.Error().Msgf("invalid message %s", msg)
return
}
tx, err = signer.SignCommandTx(msg[0], msg[1], to, send.GetCurrentOutTxParam(), gasLimit, gasprice, height)
} else if send.InboundTxParams.SenderChainId == common.ZetaChain().ChainId && send.CctxStatus.Status == types.CctxStatus_PendingOutbound && flags.IsOutboundEnabled {
if send.GetCurrentOutTxParam().CoinType == common.CoinType_Gas {
logger.Info().Msgf("SignWithdrawTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice)
tx, err = signer.SignWithdrawTx(
to,
send.GetCurrentOutTxParam().Amount.BigInt(),
send.GetCurrentOutTxParam().OutboundTxTssNonce,
gasprice,
height,
)
}
if send.GetCurrentOutTxParam().CoinType == common.CoinType_ERC20 {
asset := ethcommon.HexToAddress(send.InboundTxParams.Asset)
logger.Info().Msgf("SignERC20WithdrawTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice)
tx, err = signer.SignERC20WithdrawTx(
to,
asset,
send.GetCurrentOutTxParam().Amount.BigInt(),
gasLimit,
send.GetCurrentOutTxParam().OutboundTxTssNonce,
gasprice,
height,
)
}
if send.GetCurrentOutTxParam().CoinType == common.CoinType_Zeta {
logger.Info().Msgf("SignOutboundTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice)
tx, err = signer.SignOutboundTx(
ethcommon.HexToAddress(send.InboundTxParams.Sender),
big.NewInt(send.InboundTxParams.SenderChainId),
to,
send.GetCurrentOutTxParam().Amount.BigInt(),
gasLimit,
message,
sendhash,
send.GetCurrentOutTxParam().OutboundTxTssNonce,
gasprice,
height,
)
}
} else if send.CctxStatus.Status == types.CctxStatus_PendingRevert && send.OutboundTxParams[0].ReceiverChainId == common.ZetaChain().ChainId {
if send.GetCurrentOutTxParam().CoinType == common.CoinType_Gas {
logger.Info().Msgf("SignWithdrawTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice)
tx, err = signer.SignWithdrawTx(
to,
send.GetCurrentOutTxParam().Amount.BigInt(),
send.GetCurrentOutTxParam().OutboundTxTssNonce,
gasprice,
height,
)
}
if send.GetCurrentOutTxParam().CoinType == common.CoinType_ERC20 {
asset := ethcommon.HexToAddress(send.InboundTxParams.Asset)
logger.Info().Msgf("SignERC20WithdrawTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice)
tx, err = signer.SignERC20WithdrawTx(
to,
asset,
send.GetCurrentOutTxParam().Amount.BigInt(),
gasLimit,
send.GetCurrentOutTxParam().OutboundTxTssNonce,
gasprice,
height,
)
}
} else if send.CctxStatus.Status == types.CctxStatus_PendingRevert {
logger.Info().Msgf("SignRevertTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice)
tx, err = signer.SignRevertTx(
ethcommon.HexToAddress(send.InboundTxParams.Sender),
big.NewInt(send.OutboundTxParams[0].ReceiverChainId),
to.Bytes(),
big.NewInt(send.GetCurrentOutTxParam().ReceiverChainId),
send.GetCurrentOutTxParam().Amount.BigInt(),
gasLimit,
message,
sendhash,
send.GetCurrentOutTxParam().OutboundTxTssNonce,
gasprice,
height,
)
} else if send.CctxStatus.Status == types.CctxStatus_PendingOutbound {
logger.Info().Msgf("SignOutboundTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice)
tx, err = signer.SignOutboundTx(
ethcommon.HexToAddress(send.InboundTxParams.Sender),
big.NewInt(send.InboundTxParams.SenderChainId),
to,
send.GetCurrentOutTxParam().Amount.BigInt(),
gasLimit,
message,
sendhash,
send.GetCurrentOutTxParam().OutboundTxTssNonce,
gasprice,
height,
)
}
if err != nil {
logger.Warn().Err(err).Msgf("signer SignOutbound error: nonce %d chain %d", send.GetCurrentOutTxParam().OutboundTxTssNonce, send.GetCurrentOutTxParam().ReceiverChainId)
return
}
logger.Info().Msgf("Key-sign success: %d => %s, nonce %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce)
_, err = zetaBridge.GetObserverList(*toChain)
if err != nil {
logger.Warn().Err(err).Msgf("unable to get observer list: chain %d observation %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, observertypes.ObservationType_OutBoundTx.String())
}
if tx != nil {
outTxHash := tx.Hash().Hex()
logger.Info().Msgf("on chain %s nonce %d, outTxHash %s signer %s", signer.chain, send.GetCurrentOutTxParam().OutboundTxTssNonce, outTxHash, myID)
//if len(signers) == 0 || myid == signers[send.OutboundTxParams.Broadcaster] || myid == signers[int(send.OutboundTxParams.Broadcaster+1)%len(signers)] {
backOff := 1000 * time.Millisecond
// retry loop: 1s, 2s, 4s, 8s, 16s in case of RPC error
for i := 0; i < 5; i++ {
logger.Info().Msgf("broadcasting tx %s to chain %s: nonce %d, retry %d", outTxHash, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, i)
// #nosec G404 randomness is not a security issue here
time.Sleep(time.Duration(rand.Intn(1500)) * time.Millisecond) // FIXME: use backoff
err := signer.Broadcast(tx)
if err != nil {
log.Warn().Err(err).Msgf("OutTx Broadcast error")
retry, report := HandleBroadcastError(err, strconv.FormatUint(send.GetCurrentOutTxParam().OutboundTxTssNonce, 10), toChain.String(), outTxHash)
if report {
zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash, nil, "", -1)
if err != nil {
logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash)
}
logger.Info().Msgf("Broadcast to core successful %s", zetaHash)
}
if !retry {
break
}
backOff *= 2
continue
}
logger.Info().Msgf("Broadcast success: nonce %d to chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash)
zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash, nil, "", -1)
if err != nil {
logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash)
}
logger.Info().Msgf("Broadcast to core successful %s", zetaHash)
break // successful broadcast; no need to retry
}
}
}
// SignERC20WithdrawTx
// function withdraw(
// address recipient,
// address asset,
// uint256 amount,
// ) external onlyTssAddress
func (signer *EVMSigner) SignERC20WithdrawTx(
recipient ethcommon.Address,
asset ethcommon.Address,
amount *big.Int,
gasLimit uint64,
nonce uint64,
gasPrice *big.Int,
height uint64,
) (*ethtypes.Transaction, error) {
var data []byte
var err error
data, err = signer.erc20CustodyABI.Pack("withdraw", recipient, asset, amount)
if err != nil {
return nil, fmt.Errorf("pack error: %w", err)
}
tx, _, _, err := signer.Sign(data, signer.erc20CustodyContractAddress, gasLimit, gasPrice, nonce, height)
if err != nil {
return nil, fmt.Errorf("sign error: %w", err)
}
return tx, nil
}
// SignWhitelistTx
// function whitelist(
// address asset,
// ) external onlyTssAddress
// function unwhitelist(
// address asset,
// ) external onlyTssAddress
func (signer *EVMSigner) SignWhitelistTx(
action string,
_ ethcommon.Address,
asset ethcommon.Address,
gasLimit uint64,
nonce uint64,
gasPrice *big.Int,
height uint64,
) (*ethtypes.Transaction, error) {
var data []byte
var err error
data, err = signer.erc20CustodyABI.Pack(action, asset)
if err != nil {
return nil, fmt.Errorf("pack error: %w", err)
}
tx, _, _, err := signer.Sign(data, signer.erc20CustodyContractAddress, gasLimit, gasPrice, nonce, height)
if err != nil {
return nil, fmt.Errorf("Sign error: %w", err)
}
return tx, nil
}
func roundUpToNearestGwei(gasPrice *big.Int) *big.Int {
oneGwei := big.NewInt(1_000_000_000) // 1 Gwei
mod := new(big.Int)
mod.Mod(gasPrice, oneGwei)
if mod.Cmp(big.NewInt(0)) == 0 { // gasprice is already a multiple of 1 Gwei
return gasPrice
}
return new(big.Int).Add(gasPrice, new(big.Int).Sub(oneGwei, mod))
}
package zetaclient
import (
"errors"
"fmt"
"math/big"
"github.com/btcsuite/btcd/chaincfg/chainhash"
ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"golang.org/x/net/context"
)
// ExternalChainWatcherForNewInboundTrackerSuggestions At each tick, gets a list of Inbound tracker suggestions from zeta-core and tries to check if the in-tx was confirmed.
// If it was, it tries to broadcast the confirmation vote. If this zeta client has previously broadcast the vote, the tx would be rejected
func (ob *EVMChainClient) ExternalChainWatcherForNewInboundTrackerSuggestions() {
ticker := NewDynamicTicker(fmt.Sprintf("EVM_ExternalChainWatcher_InboundTrackerSuggestions_%d", ob.chain.ChainId), ob.GetCoreParams().InTxTicker)
defer ticker.Stop()
ob.logger.ExternalChainWatcher.Info().Msg("ExternalChainWatcher for inboundTrackerSuggestions started")
for {
select {
case <-ticker.C():
err := ob.ObserveTrackerSuggestions()
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("ObserveTrackerSuggestions error")
}
ticker.UpdateInterval(ob.GetCoreParams().InTxTicker, ob.logger.ExternalChainWatcher)
case <-ob.stop:
ob.logger.ExternalChainWatcher.Info().Msg("ExternalChainWatcher for inboundTrackerSuggestions stopped")
return
}
}
}
func (ob *BitcoinChainClient) ExternalChainWatcherForNewInboundTrackerSuggestions() {
ticker := NewDynamicTicker("Bitcoin_WatchInTx_InboundTrackerSuggestions", ob.GetCoreParams().InTxTicker)
defer ticker.Stop()
for {
select {
case <-ticker.C():
err := ob.ObserveTrackerSuggestions()
if err != nil {
ob.logger.WatchInTx.Error().Err(err).Msg("error observing in tx")
}
ticker.UpdateInterval(ob.GetCoreParams().InTxTicker, ob.logger.WatchInTx)
case <-ob.stop:
ob.logger.WatchInTx.Info().Msg("ExternalChainWatcher for BTC inboundTrackerSuggestions stopped")
return
}
}
}
func (ob *BitcoinChainClient) ObserveTrackerSuggestions() error {
trackers, err := ob.zetaClient.GetInboundTrackersForChain(ob.chain.ChainId)
if err != nil {
return err
}
for _, tracker := range trackers {
ob.logger.WatchInTx.Info().Msgf("checking tracker with hash :%s and coin-type :%s ", tracker.TxHash, tracker.CoinType)
ballotIdentifier, err := ob.CheckReceiptForBtcTxHash(tracker.TxHash, true)
if err != nil {
return err
}
ob.logger.WatchInTx.Info().Msgf("Vote submitted for inbound Tracker,Chain : %s,Ballot Identifier : %s, coin-type %s", ob.chain.ChainName, ballotIdentifier, common.CoinType_Gas.String())
}
return nil
}
func (ob *BitcoinChainClient) CheckReceiptForBtcTxHash(txHash string, vote bool) (string, error) {
hash, err := chainhash.NewHashFromStr(txHash)
if err != nil {
return "", err
}
tx, err := ob.rpcClient.GetRawTransactionVerbose(hash)
if err != nil {
return "", err
}
blockHash, err := chainhash.NewHashFromStr(tx.BlockHash)
if err != nil {
return "", err
}
block, err := ob.rpcClient.GetBlockVerbose(blockHash)
if err != nil {
return "", err
}
tss, err := ob.zetaClient.GetBtcTssAddress()
if err != nil {
return "", err
}
// #nosec G701 always positive
event, err := GetBtcEvent(*tx, tss, uint64(block.Height), &ob.logger.WatchInTx)
if err != nil {
return "", err
}
if event == nil {
return "", errors.New("no btc deposit event found")
}
msg := ob.GetInboundVoteMessageFromBtcEvent(event)
if !vote {
return msg.Digest(), nil
}
zetaHash, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, msg)
if err != nil {
ob.logger.WatchInTx.Error().Err(err).Msg("error posting to zeta core")
return "", err
}
ob.logger.WatchInTx.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
return msg.Digest(), nil
}
func (ob *EVMChainClient) ObserveTrackerSuggestions() error {
trackers, err := ob.zetaClient.GetInboundTrackersForChain(ob.chain.ChainId)
if err != nil {
return err
}
for _, tracker := range trackers {
ob.logger.ExternalChainWatcher.Info().Msgf("checking tracker with hash :%s and coin-type :%s ", tracker.TxHash, tracker.CoinType)
switch tracker.CoinType {
case common.CoinType_Zeta:
ballotIdentifier, err := ob.CheckReceiptForCoinTypeZeta(tracker.TxHash, true)
if err != nil {
return err
}
ob.logger.ExternalChainWatcher.Info().Msgf("Vote submitted for inbound Tracker,Chain : %s,Ballot Identifier : %s, coin-type %s", ob.chain.ChainName, ballotIdentifier, common.CoinType_Zeta.String())
case common.CoinType_ERC20:
ballotIdentifier, err := ob.CheckReceiptForCoinTypeERC20(tracker.TxHash, true)
if err != nil {
return err
}
ob.logger.ExternalChainWatcher.Info().Msgf("Vote submitted for inbound Tracker,Chain : %s,Ballot Identifier : %s, coin-type %s", ob.chain.ChainName, ballotIdentifier, common.CoinType_ERC20.String())
case common.CoinType_Gas:
ballotIdentifier, err := ob.CheckReceiptForCoinTypeGas(tracker.TxHash, true)
if err != nil {
return err
}
ob.logger.ExternalChainWatcher.Info().Msgf("Vote submitted for inbound Tracker,Chain : %s,Ballot Identifier : %s, coin-type %s", ob.chain.ChainName, ballotIdentifier, common.CoinType_Gas.String())
}
}
return nil
}
func (ob *EVMChainClient) CheckReceiptForCoinTypeZeta(txHash string, vote bool) (string, error) {
connector, err := ob.GetConnectorContract()
if err != nil {
return "", err
}
hash := ethcommon.HexToHash(txHash)
receipt, err := ob.evmClient.TransactionReceipt(context.Background(), hash)
if err != nil {
return "", err
}
var msg types.MsgVoteOnObservedInboundTx
for _, log := range receipt.Logs {
event, err := connector.ParseZetaSent(*log)
if err == nil && event != nil {
msg, err = ob.GetInboundVoteMsgForZetaSentEvent(event)
if err == nil {
break
}
}
}
if !vote {
return msg.Digest(), nil
}
zetaHash, err := ob.zetaClient.PostSend(PostSendNonEVMGasLimit, &msg)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
return "", err
}
ob.logger.ExternalChainWatcher.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
return msg.Digest(), nil
}
func (ob *EVMChainClient) CheckReceiptForCoinTypeERC20(txHash string, vote bool) (string, error) {
custody, err := ob.GetERC20CustodyContract()
if err != nil {
return "", err
}
hash := ethcommon.HexToHash(txHash)
receipt, err := ob.evmClient.TransactionReceipt(context.Background(), hash)
if err != nil {
return "", err
}
var msg types.MsgVoteOnObservedInboundTx
for _, log := range receipt.Logs {
zetaDeposited, err := custody.ParseDeposited(*log)
if err == nil && zetaDeposited != nil {
msg, err = ob.GetInboundVoteMsgForDepositedEvent(zetaDeposited)
if err == nil {
break
}
}
}
if !vote {
return msg.Digest(), nil
}
zetaHash, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, &msg)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
return "", err
}
ob.logger.ExternalChainWatcher.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
return msg.Digest(), nil
}
func (ob *EVMChainClient) CheckReceiptForCoinTypeGas(txHash string, vote bool) (string, error) {
hash := ethcommon.HexToHash(txHash)
tx, isPending, err := ob.evmClient.TransactionByHash(context.Background(), hash)
if err != nil {
return "", err
}
if isPending {
return "", errors.New("tx is still pending")
}
receipt, err := ob.evmClient.TransactionReceipt(context.Background(), hash)
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("TransactionReceipt error")
return "", err
}
if receipt.Status != 1 { // 1: successful, 0: failed
ob.logger.ExternalChainWatcher.Info().Msgf("tx %s failed; don't act", tx.Hash().Hex())
return "", errors.New("tx not successful yet")
}
block, err := ob.evmClient.BlockByNumber(context.Background(), receipt.BlockNumber)
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("BlockByNumber error")
return "", err
}
from, err := ob.evmClient.TransactionSender(context.Background(), tx, block.Hash(), receipt.TransactionIndex)
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("TransactionSender error; trying local recovery (assuming LondonSigner dynamic fee tx type) of sender address")
signer := ethtypes.NewLondonSigner(big.NewInt(ob.chain.ChainId))
from, err = signer.Sender(tx)
if err != nil {
ob.logger.ExternalChainWatcher.Err(err).Msg("local recovery of sender address failed")
return "", err
}
}
msg := ob.GetInboundVoteMsgForTokenSentToTSS(tx.Hash(), tx.Value(), receipt, from, tx.Data())
if !vote {
return msg.Digest(), nil
}
zetaHash, err := ob.zetaClient.PostSend(PostSendEVMGasLimit, msg)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
return "", err
}
ob.logger.ExternalChainWatcher.Info().Msgf("Gas Deposit detected and reported: PostSend zeta tx: %s", zetaHash)
return msg.Digest(), nil
}
package zetaclient
import (
"bytes"
"fmt"
"io"
"os"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
ckeys "github.com/cosmos/cosmos-sdk/crypto/keyring"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/common/cosmos"
"github.com/zeta-chain/zetacore/zetaclient/config"
)
// Keys manages all the keys used by zeta client
type Keys struct {
signerName string
password string // TODO this is a bad way , need to fix it
kb ckeys.Keyring
OperatorAddress sdk.AccAddress
}
// NewKeysWithKeybase create a new instance of Keys
func NewKeysWithKeybase(kb ckeys.Keyring, granterAddress sdk.AccAddress, granteeName, password string) *Keys {
return &Keys{
signerName: granteeName,
password: password,
kb: kb,
OperatorAddress: granterAddress,
}
}
func GetGranteeKeyName(signerName string) string {
return fmt.Sprintf("%s", signerName)
}
// GetKeyringKeybase return keyring and key info
func GetKeyringKeybase(cfg *config.Config) (ckeys.Keyring, string, error) {
granteeName := cfg.AuthzHotkey
chainHomeFolder := cfg.ZetaCoreHome
password := cfg.SignerPass
logger := log.Logger.With().Str("module", "GetKeyringKeybase").Logger()
if len(granteeName) == 0 {
return nil, "", fmt.Errorf("signer name is empty")
}
if len(password) == 0 {
return nil, "", fmt.Errorf("password is empty")
}
buf := bytes.NewBufferString(password)
// the library used by keyring is using ReadLine , which expect a new line
buf.WriteByte('\n')
buf.WriteString(password)
buf.WriteByte('\n')
kb, err := getKeybase(chainHomeFolder, buf)
if err != nil {
return nil, "", fmt.Errorf("fail to get keybase,err:%w", err)
}
oldStdIn := os.Stdin
defer func() {
os.Stdin = oldStdIn
}()
os.Stdin = nil
logger.Debug().Msgf("Checking for Hotkey Key: %s \nFolder %s\nBackend %s", granteeName, chainHomeFolder, kb.Backend())
rc, err := kb.Key(granteeName)
if err != nil {
return nil, "", fmt.Errorf("key not presnt with name (%s): %w", granteeName, err)
}
pubkeyBech32, err := common.GetPubkeyBech32FromRecord(rc)
if err != nil {
return nil, "", fmt.Errorf("fail to get pubkey from record,err:%w", err)
}
return kb, pubkeyBech32, nil
}
// getKeybase will create an instance of Keybase
func getKeybase(zetaCoreHome string, reader io.Reader) (ckeys.Keyring, error) {
cliDir := zetaCoreHome
if len(zetaCoreHome) == 0 {
return nil, fmt.Errorf("zetaCoreHome is empty")
}
//FIXME: BackendTest is used for convenient testing with Starport generated accouts.
// Change to BackendFile with password!
registry := codectypes.NewInterfaceRegistry()
cryptocodec.RegisterInterfaces(registry)
cdc := codec.NewProtoCodec(registry)
return ckeys.New(sdk.KeyringServiceName(), ckeys.BackendTest, cliDir, reader, cdc)
}
// GetSignerInfo return signer info
func (k *Keys) GetSignerInfo() *ckeys.Record {
signer := GetGranteeKeyName(k.signerName)
info, err := k.kb.Key(signer)
if err != nil {
panic(err)
}
return info
}
func (k *Keys) GetOperatorAddress() sdk.AccAddress {
return k.OperatorAddress
}
func (k *Keys) GetAddress() sdk.AccAddress {
signer := GetGranteeKeyName(k.signerName)
info, err := k.kb.Key(signer)
if err != nil {
panic(err)
}
addr, err := info.GetAddress()
if err != nil {
return nil
}
return addr
}
// GetPrivateKey return the private key
func (k *Keys) GetPrivateKey() (cryptotypes.PrivKey, error) {
// return k.kb.ExportPrivateKeyObject(k.signerName)
signer := GetGranteeKeyName(k.signerName)
privKeyArmor, err := k.kb.ExportPrivKeyArmor(signer, k.password)
if err != nil {
return nil, err
}
priKey, _, err := crypto.UnarmorDecryptPrivKey(privKeyArmor, k.password)
if err != nil {
return nil, fmt.Errorf("fail to unarmor private key: %w", err)
}
return priKey, nil
}
// GetKeybase return the keybase
func (k *Keys) GetKeybase() ckeys.Keyring {
return k.kb
}
func (k *Keys) GetPubKeySet() (common.PubKeySet, error) {
pubkeySet := common.PubKeySet{
Secp256k1: "",
Ed25519: "",
}
pK, err := k.GetPrivateKey()
if err != nil {
return pubkeySet, err
}
s, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, pK.PubKey())
if err != nil {
return pubkeySet, ErrBech32ifyPubKey
}
pubkey, err := common.NewPubKey(s)
if err != nil {
return pubkeySet, ErrNewPubKey
}
pubkeySet.Secp256k1 = pubkey
return pubkeySet, nil
}
package zetaclient
import (
"context"
"encoding/json"
"errors"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rpc"
)
type KlaytnClient struct {
c *rpc.Client
}
type RPCHeader struct {
Hash *common.Hash `json:"hash"`
Number *hexutil.Big `json:"number"`
Time *hexutil.Big `json:"timestamp"`
}
type RPCTransaction struct {
From *common.Address `json:"from"`
Input hexutil.Bytes `json:"input"`
To *common.Address `json:"to"`
Hash common.Hash `json:"hash"`
Value *hexutil.Big `json:"value"`
}
type RPCBlock struct {
Hash *common.Hash `json:"hash"`
Transactions []RPCTransaction `json:"transactions"`
}
func Dial(url string) (*KlaytnClient, error) {
c, err := rpc.Dial(url)
if err != nil {
return nil, err
}
return &KlaytnClient{c}, nil
}
func (ec *KlaytnClient) BlockByNumber(ctx context.Context, number *big.Int) (*RPCBlock, error) {
return ec.getBlock(ctx, "klay_getBlockByNumber", toBlockNumArg(number), true)
}
func (ec *KlaytnClient) getBlock(ctx context.Context, method string, args ...interface{}) (*RPCBlock, error) {
var raw json.RawMessage
err := ec.c.CallContext(ctx, &raw, method, args...)
if err != nil {
return nil, err
} else if len(raw) == 0 {
return nil, errors.New("not found")
}
var block RPCBlock
if err := json.Unmarshal(raw, &block); err != nil {
return nil, err
}
return &block, nil
}
func toBlockNumArg(number *big.Int) string {
if number == nil {
return "latest"
}
return hexutil.EncodeBig(number)
}
package metrics
import (
"context"
"fmt"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog/log"
)
type Metrics struct {
s *http.Server
}
type MetricName int
const (
//GAUGE_PENDING_TX MetricName = iota
//
//COUNTER_NUM_RPCS
PendingTxs = "pending_txs"
)
var (
Counters = map[string]prometheus.Counter{}
Gauges = map[string]prometheus.Gauge{}
)
func NewMetrics() (*Metrics, error) {
server := http.NewServeMux()
server.Handle("/metrics",
promhttp.InstrumentMetricHandler(
prometheus.DefaultRegisterer,
promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
Timeout: 30 * time.Second,
}),
),
)
s := &http.Server{
Addr: fmt.Sprintf(":8886"),
Handler: server,
ReadTimeout: 5 * time.Second,
ReadHeaderTimeout: 5 * time.Second,
}
return &Metrics{
s,
}, nil
}
func (m *Metrics) RegisterCounter(name string, help string) error {
if _, found := Counters[name]; found {
return fmt.Errorf("counter %s already registered", name)
}
counter := prometheus.NewCounter(prometheus.CounterOpts{
Name: name,
Help: help,
})
prometheus.MustRegister(counter)
Counters[name] = counter
return nil
}
func (m *Metrics) RegisterGauge(name string, help string) error {
if _, found := Gauges[name]; found {
return fmt.Errorf("gauge %s already registered", name)
}
var gauge = prometheus.NewGauge(prometheus.GaugeOpts{
Name: name,
Help: help,
})
prometheus.MustRegister(gauge)
Gauges[name] = gauge
return nil
}
func (m *Metrics) Start() {
log.Info().Msg("metrics server starting")
go func() {
if err := m.s.ListenAndServe(); err != nil {
log.Error().Err(err).Msg("fail to start metric server")
}
}()
}
func (m *Metrics) Stop() error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()
return m.s.Shutdown(ctx)
}
package zetaclient
// returns the maximum of two ints
func MaxInt(a int, b int) int {
if a < b {
return b
}
return a
}
package zetaclient
import (
"sync"
"time"
"github.com/rs/zerolog"
)
type OutTxProcessorManager struct {
outTxStartTime map[string]time.Time
outTxEndTime map[string]time.Time
outTxActive map[string]struct{}
mu sync.Mutex
Logger zerolog.Logger
numActiveProcessor int64
}
func NewOutTxProcessorManager(logger zerolog.Logger) *OutTxProcessorManager {
return &OutTxProcessorManager{
outTxStartTime: make(map[string]time.Time),
outTxEndTime: make(map[string]time.Time),
outTxActive: make(map[string]struct{}),
mu: sync.Mutex{},
Logger: logger.With().Str("module", "OutTxProcessorManager").Logger(),
numActiveProcessor: 0,
}
}
func (outTxMan *OutTxProcessorManager) StartTryProcess(outTxID string) {
outTxMan.mu.Lock()
defer outTxMan.mu.Unlock()
outTxMan.outTxStartTime[outTxID] = time.Now()
outTxMan.outTxActive[outTxID] = struct{}{}
outTxMan.numActiveProcessor++
outTxMan.Logger.Info().Msgf("StartTryProcess %s, numActiveProcessor %d", outTxID, outTxMan.numActiveProcessor)
}
func (outTxMan *OutTxProcessorManager) EndTryProcess(outTxID string) {
outTxMan.mu.Lock()
defer outTxMan.mu.Unlock()
outTxMan.outTxEndTime[outTxID] = time.Now()
delete(outTxMan.outTxActive, outTxID)
outTxMan.numActiveProcessor--
outTxMan.Logger.Info().Msgf("EndTryProcess %s, numActiveProcessor %d, time elapsed %s", outTxID, outTxMan.numActiveProcessor, time.Since(outTxMan.outTxStartTime[outTxID]))
}
func (outTxMan *OutTxProcessorManager) IsOutTxActive(outTxID string) bool {
outTxMan.mu.Lock()
defer outTxMan.mu.Unlock()
_, found := outTxMan.outTxActive[outTxID]
return found
}
func (outTxMan *OutTxProcessorManager) TimeInTryProcess(outTxID string) time.Duration {
outTxMan.mu.Lock()
defer outTxMan.mu.Unlock()
if _, found := outTxMan.outTxActive[outTxID]; found {
return time.Since(outTxMan.outTxStartTime[outTxID])
}
return 0
}
package zetaclient
import (
"context"
"fmt"
"sort"
"time"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/types/query"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
tmtypes "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc"
)
type Order string
const (
NoOrder Order = ""
Ascending Order = "ASC"
Descending Order = "DESC"
)
func (b *ZetaCoreBridge) GetCrosschainFlags() (observertypes.CrosschainFlags, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.CrosschainFlags(context.Background(), &observertypes.QueryGetCrosschainFlagsRequest{})
if err != nil {
return observertypes.CrosschainFlags{}, err
}
return resp.CrosschainFlags, nil
}
func (b *ZetaCoreBridge) GetCoreParamsForChainID(externalChainID int64) (*observertypes.CoreParams, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.GetCoreParamsForChain(context.Background(), &observertypes.QueryGetCoreParamsForChainRequest{ChainId: externalChainID})
if err != nil {
return &observertypes.CoreParams{}, err
}
return resp.CoreParams, nil
}
func (b *ZetaCoreBridge) GetCoreParams() ([]*observertypes.CoreParams, error) {
client := observertypes.NewQueryClient(b.grpcConn)
var err error
resp := &observertypes.QueryGetCoreParamsResponse{}
for i := 0; i <= DefaultRetryCount; i++ {
resp, err = client.GetCoreParams(context.Background(), &observertypes.QueryGetCoreParamsRequest{})
if err == nil {
return resp.CoreParams.CoreParams, nil
}
time.Sleep(DefaultRetryInterval * time.Second)
}
return nil, fmt.Errorf("failed to get core params | err %s", err.Error())
}
func (b *ZetaCoreBridge) GetObserverParams() (observertypes.Params, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.Params(context.Background(), &observertypes.QueryParamsRequest{})
if err != nil {
return observertypes.Params{}, err
}
return resp.Params, nil
}
func (b *ZetaCoreBridge) GetUpgradePlan() (*upgradetypes.Plan, error) {
client := upgradetypes.NewQueryClient(b.grpcConn)
resp, err := client.CurrentPlan(context.Background(), &upgradetypes.QueryCurrentPlanRequest{})
if err != nil {
return nil, err
}
return resp.Plan, nil
}
func (b *ZetaCoreBridge) GetAllCctx() ([]*types.CrossChainTx, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.CctxAll(context.Background(), &types.QueryAllCctxRequest{})
if err != nil {
return nil, err
}
return resp.CrossChainTx, nil
}
func (b *ZetaCoreBridge) GetCctxByHash(sendHash string) (*types.CrossChainTx, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.Cctx(context.Background(), &types.QueryGetCctxRequest{Index: sendHash})
if err != nil {
return nil, err
}
return resp.CrossChainTx, nil
}
func (b *ZetaCoreBridge) GetCctxByNonce(chainID int64, nonce uint64) (*types.CrossChainTx, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.CctxByNonce(context.Background(), &types.QueryGetCctxByNonceRequest{
ChainID: chainID,
Nonce: nonce,
})
if err != nil {
return nil, err
}
return resp.CrossChainTx, nil
}
func (b *ZetaCoreBridge) GetObserverList(chain common.Chain) ([]string, error) {
var err error
client := observertypes.NewQueryClient(b.grpcConn)
for i := 0; i <= DefaultRetryCount; i++ {
resp, err := client.ObserversByChain(context.Background(), &observertypes.QueryObserversByChainRequest{ObservationChain: chain.ChainName.String()})
if err == nil {
return resp.Observers, nil
}
time.Sleep(DefaultRetryInterval * time.Second)
}
return nil, err
}
func (b *ZetaCoreBridge) GetAllPendingCctx(chainID int64) ([]*types.CrossChainTx, error) {
client := types.NewQueryClient(b.grpcConn)
maxSizeOption := grpc.MaxCallRecvMsgSize(32 * 1024 * 1024)
resp, err := client.CctxAllPending(context.Background(), &types.QueryAllCctxPendingRequest{ChainId: chainID}, maxSizeOption)
if err != nil {
return nil, err
}
return resp.CrossChainTx, nil
}
func (b *ZetaCoreBridge) GetLastBlockHeight() ([]*types.LastBlockHeight, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.LastBlockHeightAll(context.Background(), &types.QueryAllLastBlockHeightRequest{})
if err != nil {
b.logger.Error().Err(err).Msg("query GetBlockHeight error")
return nil, err
}
return resp.LastBlockHeight, nil
}
func (b *ZetaCoreBridge) GetLatestZetaBlock() (*tmtypes.Block, error) {
client := tmservice.NewServiceClient(b.grpcConn)
res, err := client.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{})
if err != nil {
return nil, err
}
return res.Block, nil
}
func (b *ZetaCoreBridge) GetNodeInfo() (*tmservice.GetNodeInfoResponse, error) {
var err error
client := tmservice.NewServiceClient(b.grpcConn)
for i := 0; i <= DefaultRetryCount; i++ {
res, err := client.GetNodeInfo(context.Background(), &tmservice.GetNodeInfoRequest{})
if err == nil {
return res, nil
}
time.Sleep(DefaultRetryInterval * time.Second)
}
return nil, err
}
func (b *ZetaCoreBridge) GetLastBlockHeightByChain(chain common.Chain) (*types.LastBlockHeight, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.LastBlockHeight(context.Background(), &types.QueryGetLastBlockHeightRequest{Index: chain.ChainName.String()})
if err != nil {
return nil, err
}
return resp.LastBlockHeight, nil
}
func (b *ZetaCoreBridge) GetZetaBlockHeight() (int64, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.LastZetaHeight(context.Background(), &types.QueryLastZetaHeightRequest{})
if err != nil {
return 0, err
}
return resp.Height, nil
}
func (b *ZetaCoreBridge) GetNonceByChain(chain common.Chain) (*types.ChainNonces, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.ChainNonces(context.Background(), &types.QueryGetChainNoncesRequest{Index: chain.ChainName.String()})
if err != nil {
return nil, err
}
return resp.ChainNonces, nil
}
func (b *ZetaCoreBridge) GetAllNodeAccounts() ([]*observertypes.NodeAccount, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.NodeAccountAll(context.Background(), &observertypes.QueryAllNodeAccountRequest{})
if err != nil {
return nil, err
}
b.logger.Debug().Msgf("GetAllNodeAccounts: %d", len(resp.NodeAccount))
return resp.NodeAccount, nil
}
func (b *ZetaCoreBridge) GetKeyGen() (*observertypes.Keygen, error) {
var err error
client := observertypes.NewQueryClient(b.grpcConn)
for i := 0; i <= ExtendedRetryCount; i++ {
resp, err := client.Keygen(context.Background(), &observertypes.QueryGetKeygenRequest{})
if err == nil {
return resp.Keygen, nil
}
time.Sleep(DefaultRetryInterval * time.Second)
}
return nil, fmt.Errorf("failed to get keygen | err %s", err.Error())
}
func (b *ZetaCoreBridge) GetBallot(ballotIdentifier string) (*observertypes.QueryBallotByIdentifierResponse, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.BallotByIdentifier(context.Background(), &observertypes.QueryBallotByIdentifierRequest{
BallotIdentifier: ballotIdentifier,
})
if err != nil {
return nil, err
}
return resp, nil
}
func (b *ZetaCoreBridge) GetInboundTrackersForChain(chainID int64) ([]types.InTxTracker, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.InTxTrackerAllByChain(context.Background(), &types.QueryAllInTxTrackerByChainRequest{ChainId: chainID})
if err != nil {
return nil, err
}
return resp.InTxTracker, nil
}
func (b *ZetaCoreBridge) GetCurrentTss() (*types.TSS, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.TSS(context.Background(), &types.QueryGetTSSRequest{})
if err != nil {
return nil, err
}
return resp.TSS, nil
}
func (b *ZetaCoreBridge) GetEthTssAddress() (string, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.GetTssAddress(context.Background(), &types.QueryGetTssAddressRequest{})
if err != nil {
return "", err
}
return resp.Eth, nil
}
func (b *ZetaCoreBridge) GetBtcTssAddress() (string, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.GetTssAddress(context.Background(), &types.QueryGetTssAddressRequest{})
if err != nil {
return "", err
}
return resp.Btc, nil
}
func (b *ZetaCoreBridge) GetTssHistory() ([]types.TSS, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.TssHistory(context.Background(), &types.QueryTssHistoryRequest{})
if err != nil {
return nil, err
}
return resp.TssList, nil
}
func (b *ZetaCoreBridge) GetOutTxTracker(chain common.Chain, nonce uint64) (*types.OutTxTracker, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.OutTxTracker(context.Background(), &types.QueryGetOutTxTrackerRequest{
ChainID: chain.ChainId,
Nonce: nonce,
})
if err != nil {
return nil, err
}
return &resp.OutTxTracker, nil
}
func (b *ZetaCoreBridge) GetAllOutTxTrackerByChain(chain common.Chain, order Order) ([]types.OutTxTracker, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.OutTxTrackerAllByChain(context.Background(), &types.QueryAllOutTxTrackerByChainRequest{
Chain: chain.ChainId,
Pagination: &query.PageRequest{
Key: nil,
Offset: 0,
Limit: 2000,
CountTotal: false,
Reverse: false,
},
})
if err != nil {
return nil, err
}
if order == Ascending {
sort.SliceStable(resp.OutTxTracker, func(i, j int) bool {
return resp.OutTxTracker[i].Nonce < resp.OutTxTracker[j].Nonce
})
}
if order == Descending {
sort.SliceStable(resp.OutTxTracker, func(i, j int) bool {
return resp.OutTxTracker[i].Nonce > resp.OutTxTracker[j].Nonce
})
}
return resp.OutTxTracker, nil
}
func (b *ZetaCoreBridge) GetClientParams(chainID int64) (observertypes.QueryGetCoreParamsForChainResponse, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.GetCoreParamsForChain(context.Background(), &observertypes.QueryGetCoreParamsForChainRequest{ChainId: chainID})
if err != nil {
return observertypes.QueryGetCoreParamsForChainResponse{}, err
}
return *resp, nil
}
func (b *ZetaCoreBridge) GetPendingNoncesByChain(chainID int64) (types.PendingNonces, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.PendingNoncesByChain(context.Background(), &types.QueryPendingNoncesByChainRequest{ChainId: chainID})
if err != nil {
return types.PendingNonces{}, err
}
return resp.PendingNonces, nil
}
func (b *ZetaCoreBridge) GetSupportedChains() ([]*common.Chain, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.SupportedChains(context.Background(), &observertypes.QuerySupportedChains{})
if err != nil {
return nil, err
}
return resp.GetChains(), nil
}
func (b *ZetaCoreBridge) GetPendingNonces() (*types.QueryAllPendingNoncesResponse, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.PendingNoncesAll(context.Background(), &types.QueryAllPendingNoncesRequest{})
if err != nil {
return nil, err
}
return resp, nil
}
func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, proof *common.Proof, chainID int64) (bool, error) {
client := observertypes.NewQueryClient(b.grpcConn)
resp, err := client.Prove(context.Background(), &observertypes.QueryProveRequest{
BlockHash: blockHash,
TxIndex: txIndex,
Proof: proof,
ChainId: chainID,
TxHash: txHash,
})
if err != nil {
return false, err
}
return resp.Valid, nil
}
package zetaclient
import (
"crypto/ecdsa"
"fmt"
"github.com/zeta-chain/zetacore/common"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/chaincfg"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/btcsuite/btcutil"
)
type TSSSigner interface {
Pubkey() []byte
// Sign: Specify optionalPubkey to use a different pubkey than the current pubkey set during keygen
Sign(data []byte, height uint64, nonce uint64, chain *common.Chain, optionalPubkey string) ([65]byte, error)
EVMAddress() ethcommon.Address
BTCAddress() string
BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash
PubKeyCompressedBytes() []byte
}
var _ TSSSigner = (*TestSigner)(nil)
// TestSigner is a fake signer for testing
type TestSigner struct {
PrivKey *ecdsa.PrivateKey
}
func (s TestSigner) Sign(digest []byte, _ uint64, _ uint64, _ *common.Chain, _ string) ([65]byte, error) {
sig, err := crypto.Sign(digest, s.PrivKey)
if err != nil {
return [65]byte{}, err
}
var sigbyte [65]byte
copy(sigbyte[:], sig[:65])
return sigbyte, nil
}
func (s TestSigner) Pubkey() []byte {
publicKeyBytes := crypto.FromECDSAPub(&s.PrivKey.PublicKey)
return publicKeyBytes
}
// PubKeyCompressedBytes returns 33B compressed pubkey
func (s TestSigner) PubKeyCompressedBytes() []byte {
pkBytes := crypto.FromECDSAPub(&s.PrivKey.PublicKey)
pk, err := btcec.ParsePubKey(pkBytes)
if err != nil {
panic(err)
}
return pk.SerializeCompressed()
}
func (s TestSigner) EVMAddress() ethcommon.Address {
return crypto.PubkeyToAddress(s.PrivKey.PublicKey)
}
func (s TestSigner) BTCAddress() string {
testnet3Addr := s.BTCAddressPubkey()
if testnet3Addr == nil {
return ""
}
return testnet3Addr.EncodeAddress()
}
func (s TestSigner) BTCAddressPubkey() *btcutil.AddressPubKey {
pkBytes := crypto.FromECDSAPub(&s.PrivKey.PublicKey)
pk, err := btcec.ParsePubKey(pkBytes)
if err != nil {
fmt.Printf("error parsing pubkey: %v", err)
return nil
}
testnet3Addr, err := btcutil.NewAddressPubKey(pk.SerializeCompressed(), &chaincfg.TestNet3Params)
if err != nil {
fmt.Printf("error NewAddressPubKey: %v", err)
return nil
}
return testnet3Addr
}
func (s TestSigner) BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash {
pkBytes := crypto.FromECDSAPub(&s.PrivKey.PublicKey)
pk, err := btcec.ParsePubKey(pkBytes)
if err != nil {
fmt.Printf("error parsing pubkey: %v", err)
return nil
}
// witness program: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Witness_program
// The HASH160 of the public key must match the 20-byte witness program.
addrWPKH, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pk.SerializeCompressed()), &chaincfg.TestNet3Params)
if err != nil {
fmt.Printf("error NewAddressWitnessPubKeyHash: %v", err)
return nil
}
return addrWPKH
}
package zetaclient
import (
"github.com/zeta-chain/zetacore/common"
)
// Modify to update this from the core later
func GetSupportedChains() []*common.Chain {
return common.DefaultChainsList()
}
package zetaclient
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"sync"
"time"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/zetaclient/types"
)
// TelemetryServer provide http endpoint for Tss server
type TelemetryServer struct {
logger zerolog.Logger
s *http.Server
p2pid string
lastScannedBlockNumber map[int64]int64 // chainid => block number
lastCoreBlockNumber int64
mu sync.Mutex
lastStartTimestamp time.Time
status types.Status
ipAddress string
}
// NewTelemetryServer should only listen to the loopback
func NewTelemetryServer() *TelemetryServer {
hs := &TelemetryServer{
logger: log.With().Str("module", "http").Logger(),
lastScannedBlockNumber: make(map[int64]int64),
lastStartTimestamp: time.Now(),
}
s := &http.Server{
Addr: ":8123",
Handler: hs.Handlers(),
ReadTimeout: 5 * time.Second,
ReadHeaderTimeout: 5 * time.Second,
}
hs.s = s
return hs
}
func (t *TelemetryServer) GetLastStartTimestamp() time.Time {
t.mu.Lock()
defer t.mu.Unlock()
return t.lastStartTimestamp
}
// setter/getter for p2pid
func (t *TelemetryServer) SetP2PID(p2pid string) {
t.mu.Lock()
t.p2pid = p2pid
t.mu.Unlock()
}
func (t *TelemetryServer) GetP2PID() string {
t.mu.Lock()
defer t.mu.Unlock()
return t.p2pid
}
// setter/getter for p2pid
func (t *TelemetryServer) SetIPAddress(ip string) {
t.mu.Lock()
t.ipAddress = ip
t.mu.Unlock()
}
func (t *TelemetryServer) GetIPAddress() string {
t.mu.Lock()
defer t.mu.Unlock()
return t.ipAddress
}
// setter for lastScanned block number
func (t *TelemetryServer) SetLastScannedBlockNumber(chainID int64, blockNumber int64) {
t.mu.Lock()
t.lastScannedBlockNumber[chainID] = blockNumber
t.mu.Unlock()
}
func (t *TelemetryServer) GetLastScannedBlockNumber(chainID int64) int64 {
t.mu.Lock()
defer t.mu.Unlock()
return t.lastScannedBlockNumber[chainID]
}
func (t *TelemetryServer) SetCoreBlockNumber(blockNumber int64) {
t.mu.Lock()
t.lastCoreBlockNumber = blockNumber
t.mu.Unlock()
}
func (t *TelemetryServer) GetCoreBlockNumber() int64 {
t.mu.Lock()
defer t.mu.Unlock()
return t.lastCoreBlockNumber
}
func (t *TelemetryServer) SetNumberOfUTXOs(numberOfUTXOs int) {
t.mu.Lock()
t.status.BTCNumberOfUTXOs = numberOfUTXOs
t.mu.Unlock()
}
// NewHandler registers the API routes and returns a new HTTP handler
func (t *TelemetryServer) Handlers() http.Handler {
router := mux.NewRouter()
router.Handle("/ping", http.HandlerFunc(t.pingHandler)).Methods(http.MethodGet)
router.Handle("/p2p", http.HandlerFunc(t.p2pHandler)).Methods(http.MethodGet)
router.Handle("/version", http.HandlerFunc(t.versionHandler)).Methods(http.MethodGet)
router.Handle("/lastscannedblock", http.HandlerFunc(t.lastScannedBlockHandler)).Methods(http.MethodGet)
router.Handle("/laststarttimestamp", http.HandlerFunc(t.lastStartTimestampHandler)).Methods(http.MethodGet)
router.Handle("/lastcoreblock", http.HandlerFunc(t.lastCoreBlockHandler)).Methods(http.MethodGet)
router.Handle("/status", http.HandlerFunc(t.statusHandler)).Methods(http.MethodGet)
router.Handle("/ip", http.HandlerFunc(t.ipHandler)).Methods(http.MethodGet)
// router.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
// router.Handle("/debug/pprof/heap", pprof.Handler("heap"))
// router.HandleFunc("/debug/pprof/", pprof.Index)
// router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
//router.Handle("/pending", http.HandlerFunc(t.pendingHandler)).Methods(http.MethodGet)
router.Use(logMiddleware())
return router
}
func (t *TelemetryServer) Start() error {
if t.s == nil {
return errors.New("invalid http server instance")
}
if err := t.s.ListenAndServe(); err != nil {
if err != http.ErrServerClosed {
return fmt.Errorf("fail to start http server: %w", err)
}
}
return nil
}
func logMiddleware() mux.MiddlewareFunc {
return func(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Debug().
Str("route", r.URL.Path).
Str("port", r.URL.Port()).
Str("method", r.Method).
Msg("HTTP request received")
handler.ServeHTTP(w, r)
})
}
}
func (t *TelemetryServer) Stop() error {
c, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
err := t.s.Shutdown(c)
if err != nil {
log.Error().Err(err).Msg("Failed to shutdown the HTTP server gracefully")
}
return err
}
func (t *TelemetryServer) pingHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (t *TelemetryServer) p2pHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
t.mu.Lock()
defer t.mu.Unlock()
fmt.Fprintf(w, "%s", t.p2pid)
}
func (t *TelemetryServer) ipHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
t.mu.Lock()
defer t.mu.Unlock()
fmt.Fprintf(w, "%s", t.ipAddress)
}
func (t *TelemetryServer) lastScannedBlockHandler(w http.ResponseWriter, _ *http.Request) {
//w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
t.mu.Lock()
defer t.mu.Unlock()
// Convert map to JSON
jsonBytes, err := json.Marshal(t.lastScannedBlockNumber)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = w.Write(jsonBytes)
if err != nil {
t.logger.Error().Err(err).Msg("Failed to write response")
}
}
func (t *TelemetryServer) lastCoreBlockHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
t.mu.Lock()
defer t.mu.Unlock()
fmt.Fprintf(w, "%d", t.lastCoreBlockNumber)
}
func (t *TelemetryServer) statusHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
t.mu.Lock()
defer t.mu.Unlock()
s, err := json.MarshalIndent(t.status, "", "\t")
if err != nil {
t.logger.Error().Err(err).Msg("Failed to marshal status")
}
fmt.Fprintf(w, "%s", s)
}
func (t *TelemetryServer) versionHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "%s", common.Version)
}
func (t *TelemetryServer) lastStartTimestampHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
t.mu.Lock()
defer t.mu.Unlock()
fmt.Fprintf(w, "%s", t.lastStartTimestamp.Format(time.RFC3339))
}
package zetaclient
import (
"bytes"
"encoding/base64"
"encoding/hex"
"fmt"
"os"
"path"
"path/filepath"
"sort"
"strings"
"time"
"github.com/binance-chain/tss-lib/ecdsa/keygen"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcutil"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
gopeer "github.com/libp2p/go-libp2p/core/peer"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
tmcrypto "github.com/tendermint/tendermint/crypto"
"github.com/zeta-chain/zetacore/common"
zcommon "github.com/zeta-chain/zetacore/common/cosmos"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
"github.com/zeta-chain/zetacore/zetaclient/metrics"
thorcommon "gitlab.com/thorchain/tss/go-tss/common"
"gitlab.com/thorchain/tss/go-tss/keysign"
"gitlab.com/thorchain/tss/go-tss/p2p"
"gitlab.com/thorchain/tss/go-tss/tss"
)
type TSSKey struct {
PubkeyInBytes []byte // FIXME: compressed pubkey?
PubkeyInBech32 string // FIXME: same above
AddressInHex string
}
func NewTSSKey(pk string) (*TSSKey, error) {
TSSKey := &TSSKey{
PubkeyInBech32: pk,
}
pubkey, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, pk)
if err != nil {
log.Error().Err(err).Msgf("GetPubKeyFromBech32 from %s", pk)
return nil, fmt.Errorf("GetPubKeyFromBech32: %w", err)
}
decompresspubkey, err := crypto.DecompressPubkey(pubkey.Bytes())
if err != nil {
return nil, fmt.Errorf("NewTSS: DecompressPubkey error: %w", err)
}
TSSKey.PubkeyInBytes = crypto.FromECDSAPub(decompresspubkey)
TSSKey.AddressInHex = crypto.PubkeyToAddress(*decompresspubkey).Hex()
return TSSKey, nil
}
var _ TSSSigner = (*TSS)(nil)
// TSS is a struct that holds the server and the keys for TSS
type TSS struct {
Server *tss.TssServer
Keys map[string]*TSSKey // PubkeyInBech32 => TSSKey
CurrentPubkey string
logger zerolog.Logger
Signers []string
CoreBridge ZetaCoreBridger
Metrics *ChainMetrics
}
// NewTSS creates a new TSS instance
func NewTSS(
peer p2p.AddrList,
privkey tmcrypto.PrivKey,
preParams *keygen.LocalPreParams,
cfg *config.Config,
bridge ZetaCoreBridger,
tssHistoricalList []types.TSS,
metrics *metrics.Metrics,
) (*TSS, error) {
server, err := SetupTSSServer(peer, privkey, preParams, cfg)
if err != nil {
return nil, fmt.Errorf("SetupTSSServer error: %w", err)
}
newTss := TSS{
Server: server,
Keys: make(map[string]*TSSKey),
CurrentPubkey: cfg.CurrentTssPubkey,
logger: log.With().Str("module", "tss_signer").Logger(),
CoreBridge: bridge,
}
err = newTss.LoadTssFilesFromDirectory(cfg.TssPath)
if err != nil {
return nil, err
}
_, pubkeyInBech32, err := GetKeyringKeybase(cfg)
if err != nil {
return nil, err
}
err = newTss.VerifyKeysharesForPubkeys(tssHistoricalList, pubkeyInBech32)
if err != nil {
bridge.GetLogger().Error().Err(err).Msg("VerifyKeysharesForPubkeys fail")
}
err = newTss.RegisterMetrics(metrics)
if err != nil {
bridge.GetLogger().Err(err).Msg("tss.RegisterMetrics")
return nil, err
}
return &newTss, nil
}
func SetupTSSServer(peer p2p.AddrList, privkey tmcrypto.PrivKey, preParams *keygen.LocalPreParams, cfg *config.Config) (*tss.TssServer, error) {
bootstrapPeers := peer
log.Info().Msgf("Peers AddrList %v", bootstrapPeers)
tsspath := cfg.TssPath
if len(tsspath) == 0 {
log.Error().Msg("empty env TSSPATH")
homedir, err := os.UserHomeDir()
if err != nil {
log.Error().Err(err).Msgf("cannot get UserHomeDir")
return nil, err
}
tsspath = path.Join(homedir, ".Tss")
log.Info().Msgf("create temporary TSSPATH: %s", tsspath)
}
IP := cfg.PublicIP
if len(IP) == 0 {
log.Info().Msg("empty public IP in config")
}
tssServer, err := tss.NewTss(
bootstrapPeers,
6668,
privkey,
"MetaMetaOpenTheDoor",
tsspath,
thorcommon.TssConfig{
EnableMonitor: true,
KeyGenTimeout: 300 * time.Second, // must be shorter than constants.JailTimeKeygen
KeySignTimeout: 30 * time.Second, // must be shorter than constants.JailTimeKeysign
PartyTimeout: 30 * time.Second,
PreParamTimeout: 5 * time.Minute,
},
preParams, // use pre-generated pre-params if non-nil
IP, // for docker test
)
if err != nil {
log.Error().Err(err).Msg("NewTSS error")
return nil, fmt.Errorf("NewTSS error: %w", err)
}
err = tssServer.Start()
if err != nil {
log.Error().Err(err).Msg("tss server start error")
}
log.Info().Msgf("LocalID: %v", tssServer.GetLocalPeerID())
if tssServer.GetLocalPeerID() == "" ||
tssServer.GetLocalPeerID() == "0" ||
tssServer.GetLocalPeerID() == "000000000000000000000000000000" ||
tssServer.GetLocalPeerID() == gopeer.ID("").String() {
log.Error().Msg("tss server start error")
return nil, fmt.Errorf("tss server start error")
}
return tssServer, nil
}
// FIXME: does it return pubkey in compressed form or uncompressed?
func (tss *TSS) Pubkey() []byte {
return tss.Keys[tss.CurrentPubkey].PubkeyInBytes
}
// digest should be Hashes of some data
// Sign: Specify optionalPubkey to use a different pubkey than the current pubkey set during keygen
func (tss *TSS) Sign(digest []byte, height uint64, nonce uint64, chain *common.Chain, optionalPubKey string) ([65]byte, error) {
H := digest
log.Debug().Msgf("hash of digest is %s", H)
tssPubkey := tss.CurrentPubkey
if optionalPubKey != "" {
tssPubkey = optionalPubKey
}
// #nosec G701 always in range
keysignReq := keysign.NewRequest(tssPubkey, []string{base64.StdEncoding.EncodeToString(H)}, int64(height), nil, "0.14.0")
ksRes, err := tss.Server.KeySign(keysignReq)
if err != nil {
log.Warn().Msg("keysign fail")
}
if ksRes.Status == thorcommon.Fail {
log.Warn().Msgf("keysign status FAIL posting blame to core, blaming node(s): %#v", ksRes.Blame.BlameNodes)
digest := hex.EncodeToString(digest)
index := observertypes.GetBlameIndex(chain.ChainId, nonce, digest, height)
zetaHash, err := tss.CoreBridge.PostBlameData(&ksRes.Blame, chain.ChainId, index)
if err != nil {
log.Error().Err(err).Msg("error sending blame data to core")
return [65]byte{}, err
}
// Increment Blame counter
for _, node := range ksRes.Blame.BlameNodes {
counter, err := tss.Metrics.GetPromCounter(node.Pubkey)
if err != nil {
log.Error().Err(err).Msgf("error getting counter: %s", node.Pubkey)
continue
}
counter.Inc()
}
log.Info().Msgf("keysign posted blame data tx hash: %s", zetaHash)
}
signature := ksRes.Signatures
// [{cyP8i/UuCVfQKDsLr1kpg09/CeIHje1FU6GhfmyMD5Q= D4jXTH3/CSgCg+9kLjhhfnNo3ggy9DTQSlloe3bbKAs= eY++Z2LwsuKG1JcghChrsEJ4u9grLloaaFZNtXI3Ujk= AA==}]
// 32B msg hash, 32B R, 32B S, 1B RC
log.Info().Msgf("signature of digest is... %v", signature)
if len(signature) == 0 {
log.Warn().Err(err).Msgf("signature has length 0")
return [65]byte{}, fmt.Errorf("keysign fail: %s", err)
}
if !verifySignature(tssPubkey, signature, H) {
log.Error().Err(err).Msgf("signature verification failure")
return [65]byte{}, fmt.Errorf("signuature verification fail")
}
var sigbyte [65]byte
_, err = base64.StdEncoding.Decode(sigbyte[:32], []byte(signature[0].R))
if err != nil {
log.Error().Err(err).Msg("decoding signature R")
return [65]byte{}, fmt.Errorf("signuature verification fail")
}
_, err = base64.StdEncoding.Decode(sigbyte[32:64], []byte(signature[0].S))
if err != nil {
log.Error().Err(err).Msg("decoding signature S")
return [65]byte{}, fmt.Errorf("signuature verification fail")
}
_, err = base64.StdEncoding.Decode(sigbyte[64:65], []byte(signature[0].RecoveryID))
if err != nil {
log.Error().Err(err).Msg("decoding signature RecoveryID")
return [65]byte{}, fmt.Errorf("signuature verification fail")
}
return sigbyte, nil
}
// SignBatch is hash of some data
// digest should be batch of hashes of some data
func (tss *TSS) SignBatch(digests [][]byte, height uint64, nonce uint64, chain *common.Chain) ([][65]byte, error) {
tssPubkey := tss.CurrentPubkey
digestBase64 := make([]string, len(digests))
for i, digest := range digests {
digestBase64[i] = base64.StdEncoding.EncodeToString(digest)
}
// #nosec G701 always in range
keysignReq := keysign.NewRequest(tssPubkey, digestBase64, int64(height), nil, "0.14.0")
ksRes, err := tss.Server.KeySign(keysignReq)
if err != nil {
log.Warn().Err(err).Msg("keysign fail")
}
if ksRes.Status == thorcommon.Fail {
log.Warn().Msg("keysign status FAIL posting blame to core")
digest := combineDigests(digestBase64)
index := observertypes.GetBlameIndex(chain.ChainId, nonce, hex.EncodeToString(digest), height)
zetaHash, err := tss.CoreBridge.PostBlameData(&ksRes.Blame, chain.ChainId, index)
if err != nil {
log.Error().Err(err).Msg("error sending blame data to core")
return [][65]byte{}, err
}
// Increment Blame counter
for _, node := range ksRes.Blame.BlameNodes {
counter, err := tss.Metrics.GetPromCounter(node.Pubkey)
if err != nil {
log.Error().Err(err).Msgf("error getting counter: %s", node.Pubkey)
continue
}
counter.Inc()
}
log.Info().Msgf("keysign posted blame data tx hash: %s", zetaHash)
}
signatures := ksRes.Signatures
// [{cyP8i/UuCVfQKDsLr1kpg09/CeIHje1FU6GhfmyMD5Q= D4jXTH3/CSgCg+9kLjhhfnNo3ggy9DTQSlloe3bbKAs= eY++Z2LwsuKG1JcghChrsEJ4u9grLloaaFZNtXI3Ujk= AA==}]
// 32B msg hash, 32B R, 32B S, 1B RC
if len(signatures) != len(digests) {
log.Warn().Err(err).Msgf("signature has length (%d) not equal to length of digests (%d)", len(signatures), len(digests))
return [][65]byte{}, fmt.Errorf("keysign fail: %s", err)
}
//if !verifySignatures(tssPubkey, signatures, digests) {
// log.Error().Err(err).Msgf("signature verification failure")
// return [][65]byte{}, fmt.Errorf("signuature verification fail")
//}
pubkey, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey)
if err != nil {
log.Error().Msg("get pubkey from bech32 fail")
}
sigBytes := make([][65]byte, len(digests))
for j, H := range digests {
found := false
D := base64.StdEncoding.EncodeToString(H)
for _, signature := range signatures {
if D == signature.Msg {
found = true
_, err = base64.StdEncoding.Decode(sigBytes[j][:32], []byte(signature.R))
if err != nil {
log.Error().Err(err).Msg("decoding signature R")
return [][65]byte{}, fmt.Errorf("signuature verification fail")
}
_, err = base64.StdEncoding.Decode(sigBytes[j][32:64], []byte(signature.S))
if err != nil {
log.Error().Err(err).Msg("decoding signature S")
return [][65]byte{}, fmt.Errorf("signuature verification fail")
}
_, err = base64.StdEncoding.Decode(sigBytes[j][64:65], []byte(signature.RecoveryID))
if err != nil {
log.Error().Err(err).Msg("decoding signature RecoveryID")
return [][65]byte{}, fmt.Errorf("signuature verification fail")
}
sigPublicKey, err := crypto.SigToPub(H, sigBytes[j][:])
if err != nil {
log.Error().Err(err).Msg("SigToPub error in verify_signature")
return [][65]byte{}, fmt.Errorf("signuature verification fail")
}
compressedPubkey := crypto.CompressPubkey(sigPublicKey)
if bytes.Compare(pubkey.Bytes(), compressedPubkey) != 0 {
log.Warn().Msgf("%d-th pubkey %s recovered pubkey %s", j, pubkey.String(), hex.EncodeToString(compressedPubkey))
return [][65]byte{}, fmt.Errorf("signuature verification fail")
}
}
}
if !found {
log.Error().Err(err).Msg("signature not found")
return [][65]byte{}, fmt.Errorf("signuature verification fail")
}
}
return sigBytes, nil
}
func (tss *TSS) Validate() error {
evmAddress := tss.EVMAddress()
blankAddress := ethcommon.Address{}
if evmAddress == blankAddress {
return fmt.Errorf("invalid evm address : %s", evmAddress.String())
}
if tss.BTCAddressWitnessPubkeyHash() == nil {
return fmt.Errorf("invalid btc pub key hash : %s", tss.BTCAddress())
}
return nil
}
func (tss *TSS) EVMAddress() ethcommon.Address {
addr, err := GetTssAddrEVM(tss.CurrentPubkey)
if err != nil {
log.Error().Err(err).Msg("getKeyAddr error")
return ethcommon.Address{}
}
return addr
}
// BTCAddress generates a bech32 p2wpkh address from pubkey
func (tss *TSS) BTCAddress() string {
addr, err := GetTssAddrBTC(tss.CurrentPubkey)
if err != nil {
log.Error().Err(err).Msg("getKeyAddr error")
return ""
}
return addr
}
func (tss *TSS) BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash {
addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tss.CurrentPubkey)
if err != nil {
log.Error().Err(err).Msg("BTCAddressPubkeyHash error")
return nil
}
return addrWPKH
}
func (tss *TSS) PubKeyCompressedBytes() []byte {
pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tss.CurrentPubkey)
if err != nil {
log.Error().Err(err).Msg("PubKeyCompressedBytes error")
return nil
}
return pubk.Bytes()
}
// InsertPubKey adds a new key to the TSS keys map
func (tss *TSS) InsertPubKey(pk string) error {
TSSKey, err := NewTSSKey(pk)
if err != nil {
return err
}
tss.Keys[pk] = TSSKey
return nil
}
func (tss *TSS) RegisterMetrics(metrics *metrics.Metrics) error {
tss.Metrics = NewChainMetrics("tss", metrics)
keygenRes, err := tss.CoreBridge.GetKeyGen()
if err != nil {
return err
}
for _, key := range keygenRes.GranteePubkeys {
err := tss.Metrics.RegisterPromCounter(key, "tss node blame counter")
if err != nil {
return err
}
}
return nil
}
func (tss *TSS) VerifyKeysharesForPubkeys(tssList []types.TSS, granteePubKey32 string) error {
for _, t := range tssList {
if wasNodePartOfTss(granteePubKey32, t.TssParticipantList) {
if _, ok := tss.Keys[t.TssPubkey]; !ok {
return fmt.Errorf("pubkey %s not found in keyshare", t.TssPubkey)
}
}
}
return nil
}
func (tss *TSS) LoadTssFilesFromDirectory(tssPath string) error {
files, err := os.ReadDir(tssPath)
if err != nil {
fmt.Println("ReadDir error :", err.Error())
return err
}
found := false
var sharefiles []os.DirEntry
for _, file := range files {
if !file.IsDir() && strings.HasPrefix(filepath.Base(file.Name()), "localstate") {
sharefiles = append(sharefiles, file)
}
}
if len(sharefiles) > 0 {
sort.SliceStable(sharefiles, func(i, j int) bool {
fi, err := sharefiles[i].Info()
if err != nil {
return false
}
fj, err := sharefiles[j].Info()
if err != nil {
return false
}
return fi.ModTime().After(fj.ModTime())
})
tss.logger.Info().Msgf("found %d localstate files", len(sharefiles))
for _, localStateFile := range sharefiles {
filename := filepath.Base(localStateFile.Name())
filearray := strings.Split(filename, "-")
if len(filearray) == 2 {
log.Info().Msgf("Found stored Pubkey in local state: %s", filearray[1])
pk := strings.TrimSuffix(filearray[1], ".json")
err = tss.InsertPubKey(pk)
if err != nil {
log.Error().Err(err).Msg("InsertPubKey in NewTSS fail")
}
tss.logger.Info().Msgf("registering TSS pubkey %s (eth hex %s)", pk, tss.Keys[pk].AddressInHex)
found = true
}
}
}
if !found {
log.Info().Msg("TSS Keyshare file NOT found")
}
return nil
}
// FIXME: mainnet/testnet
func GetTssAddrBTC(tssPubkey string) (string, error) {
addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tssPubkey)
if err != nil {
log.Fatal().Err(err)
return "", err
}
return addrWPKH.EncodeAddress(), nil
}
func GetTssAddrEVM(tssPubkey string) (ethcommon.Address, error) {
var keyAddr ethcommon.Address
pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey)
if err != nil {
log.Fatal().Err(err)
return keyAddr, err
}
//keyAddrBytes := pubk.EVMAddress().Bytes()
pubk.Bytes()
decompresspubkey, err := crypto.DecompressPubkey(pubk.Bytes())
if err != nil {
log.Fatal().Err(err).Msg("decompress err")
return keyAddr, err
}
keyAddr = crypto.PubkeyToAddress(*decompresspubkey)
return keyAddr, nil
}
func TestKeysign(tssPubkey string, tssServer *tss.TssServer) error {
log.Info().Msg("trying keysign...")
data := []byte("hello meta")
H := crypto.Keccak256Hash(data)
log.Info().Msgf("hash of data (hello meta) is %s", H)
keysignReq := keysign.NewRequest(tssPubkey, []string{base64.StdEncoding.EncodeToString(H.Bytes())}, 10, nil, "0.14.0")
ksRes, err := tssServer.KeySign(keysignReq)
if err != nil {
log.Warn().Msg("keysign fail")
}
signature := ksRes.Signatures
// [{cyP8i/UuCVfQKDsLr1kpg09/CeIHje1FU6GhfmyMD5Q= D4jXTH3/CSgCg+9kLjhhfnNo3ggy9DTQSlloe3bbKAs= eY++Z2LwsuKG1JcghChrsEJ4u9grLloaaFZNtXI3Ujk= AA==}]
// 32B msg hash, 32B R, 32B S, 1B RC
log.Info().Msgf("signature of helloworld... %v", signature)
if len(signature) == 0 {
log.Info().Msgf("signature has length 0, skipping verify")
return fmt.Errorf("signature has length 0")
}
verifySignature(tssPubkey, signature, H.Bytes())
if verifySignature(tssPubkey, signature, H.Bytes()) {
return nil
}
return fmt.Errorf("verify signature fail")
}
func verifySignature(tssPubkey string, signature []keysign.Signature, H []byte) bool {
if len(signature) == 0 {
log.Warn().Msg("verify_signature: empty signature array")
return false
}
pubkey, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey)
if err != nil {
log.Error().Msg("get pubkey from bech32 fail")
}
// verify the signature of msg.
var sigbyte [65]byte
_, err = base64.StdEncoding.Decode(sigbyte[:32], []byte(signature[0].R))
if err != nil {
log.Error().Err(err).Msg("decoding signature R")
return false
}
_, err = base64.StdEncoding.Decode(sigbyte[32:64], []byte(signature[0].S))
if err != nil {
log.Error().Err(err).Msg("decoding signature S")
return false
}
_, err = base64.StdEncoding.Decode(sigbyte[64:65], []byte(signature[0].RecoveryID))
if err != nil {
log.Error().Err(err).Msg("decoding signature RecoveryID")
return false
}
sigPublicKey, err := crypto.SigToPub(H, sigbyte[:])
if err != nil {
log.Error().Err(err).Msg("SigToPub error in verify_signature")
return false
}
compressedPubkey := crypto.CompressPubkey(sigPublicKey)
log.Info().Msgf("pubkey %s recovered pubkey %s", pubkey.String(), hex.EncodeToString(compressedPubkey))
return bytes.Compare(pubkey.Bytes(), compressedPubkey) == 0
}
func combineDigests(digestList []string) []byte {
digestConcat := strings.Join(digestList[:], "")
digestBytes := chainhash.DoubleHashH([]byte(digestConcat))
return digestBytes.CloneBytes()
}
func wasNodePartOfTss(granteePubKey32 string, granteeList []string) bool {
for _, grantee := range granteeList {
if granteePubKey32 == grantee {
return true
}
}
return false
}
func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string) (*btcutil.AddressWitnessPubKeyHash, error) {
pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey)
if err != nil {
return nil, err
}
addr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubk.Bytes()), config.BitconNetParams)
if err != nil {
return nil, err
}
return addr, nil
}
package zetaclient
import (
"fmt"
"math/big"
"time"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
"gitlab.com/thorchain/tss/go-tss/blame"
)
const (
PostGasPriceGasLimit = 1_500_000
AddTxHashToOutTxTrackerGasLimit = 200_000
PostNonceGasLimit = 200_000
PostSendEVMGasLimit = 1_500_000 // likely emit a lot of logs, so costly
PostSendNonEVMGasLimit = 1_000_000
PostReceiveConfirmationGasLimit = 200_000
PostBlameDataGasLimit = 200_000
DefaultGasLimit = 200_000
PostProveOutboundTxGasLimit = 400_000
DefaultRetryCount = 5
ExtendedRetryCount = 15
DefaultRetryInterval = 5
)
func GetInBoundVoteMessage(sender string, senderChain int64, txOrigin string, receiver string, receiverChain int64, amount math.Uint, message string, inTxHash string, inBlockHeight uint64, gasLimit uint64, coinType common.CoinType, asset string, signerAddress string) *types.MsgVoteOnObservedInboundTx {
msg := types.NewMsgVoteOnObservedInboundTx(signerAddress, sender, senderChain, txOrigin, receiver, receiverChain, amount, message, inTxHash, inBlockHeight, gasLimit, coinType, asset)
return msg
}
func (b *ZetaCoreBridge) WrapMessageWithAuthz(msg sdk.Msg) (sdk.Msg, AuthZSigner, error) {
msgURL := sdk.MsgTypeURL(msg)
// verify message validity
if err := msg.ValidateBasic(); err != nil {
return nil, AuthZSigner{}, fmt.Errorf("%s invalid msg | %s", msgURL, err.Error())
}
authzSigner := GetSigner(msgURL)
authzMessage := authz.NewMsgExec(authzSigner.GranteeAddress, []sdk.Msg{msg})
return &authzMessage, authzSigner, nil
}
func (b *ZetaCoreBridge) PostGasPrice(chain common.Chain, gasPrice uint64, supply string, blockNum uint64) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
msg := types.NewMsgGasPriceVoter(signerAddress, chain.ChainId, gasPrice, supply, blockNum)
authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}
for i := 0; i < DefaultRetryCount; i++ {
zetaTxHash, err := b.Broadcast(PostGasPriceGasLimit, authzMsg, authzSigner)
if err == nil {
return zetaTxHash, nil
}
b.logger.Debug().Err(err).Msgf("PostGasPrice broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
return "", fmt.Errorf("post gasprice failed after %d retries", DefaultRetryInterval)
}
func (b *ZetaCoreBridge) AddTxHashToOutTxTracker(
chainID int64,
nonce uint64,
txHash string,
proof *common.Proof,
blockHash string,
txIndex int64,
) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
msg := types.NewMsgAddToOutTxTracker(signerAddress, chainID, nonce, txHash, proof, blockHash, txIndex)
authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}
zetaTxHash, err := b.Broadcast(AddTxHashToOutTxTrackerGasLimit, authzMsg, authzSigner)
if err != nil {
return "", err
}
return zetaTxHash, nil
}
func (b *ZetaCoreBridge) PostSend(zetaGasLimit uint64, msg *types.MsgVoteOnObservedInboundTx) (string, error) {
authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}
for i := 0; i < DefaultRetryCount; i++ {
zetaTxHash, err := b.Broadcast(zetaGasLimit, authzMsg, authzSigner)
if err == nil {
return zetaTxHash, nil
}
b.logger.Debug().Err(err).Msgf("PostSend broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
return "", fmt.Errorf("post send failed after %d retries", DefaultRetryInterval)
}
func (b *ZetaCoreBridge) PostReceiveConfirmation(
sendHash string,
outTxHash string,
outBlockHeight uint64,
outTxGasUsed uint64,
outTxEffectiveGasPrice *big.Int,
outTxEffectiveGasLimit uint64,
amount *big.Int,
status common.ReceiveStatus,
chain common.Chain,
nonce uint64,
coinType common.CoinType,
) (string, error) {
lastReport, found := b.lastOutTxReportTime[outTxHash]
if found && time.Since(lastReport) < 10*time.Minute {
return "", fmt.Errorf(
"PostReceiveConfirmation: outTxHash %s already reported in last 10min; last report %s",
outTxHash,
lastReport,
)
}
signerAddress := b.keys.GetOperatorAddress().String()
msg := types.NewMsgVoteOnObservedOutboundTx(
signerAddress,
sendHash,
outTxHash,
outBlockHeight,
outTxGasUsed,
math.NewIntFromBigInt(outTxEffectiveGasPrice),
outTxEffectiveGasLimit,
math.NewUintFromBigInt(amount),
status,
chain.ChainId,
nonce,
coinType,
)
authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}
// FIXME: remove this gas limit stuff; in the special ante handler with no gas limit, add
// NewMsgReceiveConfirmation to it.
var gasLimit uint64 = PostReceiveConfirmationGasLimit
if status == common.ReceiveStatus_Failed {
gasLimit = PostSendEVMGasLimit
}
for i := 0; i < DefaultRetryCount; i++ {
zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner)
if err == nil {
b.lastOutTxReportTime[outTxHash] = time.Now() // update last report time when bcast succeeds
return zetaTxHash, nil
}
b.logger.Debug().Err(err).Msgf("PostReceive broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
return "", fmt.Errorf("post receive failed after %d retries", DefaultRetryCount)
}
func (b *ZetaCoreBridge) SetTSS(tssPubkey string, keyGenZetaHeight int64, status common.ReceiveStatus) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
msg := types.NewMsgCreateTSSVoter(signerAddress, tssPubkey, keyGenZetaHeight, status)
authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}
zetaTxHash := ""
for i := 0; i <= DefaultRetryCount; i++ {
zetaTxHash, err = b.Broadcast(DefaultGasLimit, authzMsg, authzSigner)
if err == nil {
return zetaTxHash, nil
}
b.logger.Debug().Err(err).Msgf("SetTSS broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
return "", fmt.Errorf("set tss failed | err %s", err.Error())
}
func (b *ZetaCoreBridge) ConfigUpdater(cfg *config.Config) {
b.logger.Info().Msg("ConfigUpdater started")
ticker := time.NewTicker(time.Duration(cfg.ConfigUpdateTicker) * time.Second)
for {
select {
case <-ticker.C:
b.logger.Debug().Msg("Running Updater")
err := b.UpdateConfigFromCore(cfg, false)
if err != nil {
b.logger.Err(err).Msg("ConfigUpdater failed to update config")
}
case <-b.stop:
b.logger.Info().Msg("ConfigUpdater stopped")
return
}
}
}
func (b *ZetaCoreBridge) PostBlameData(blame *blame.Blame, chainID int64, index string) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
zetaBlame := &observerTypes.Blame{
Index: index,
FailureReason: blame.FailReason,
Nodes: observerTypes.ConvertNodes(blame.BlameNodes),
}
msg := observerTypes.NewMsgAddBlameVoteMsg(signerAddress, chainID, zetaBlame)
authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}
var gasLimit uint64 = PostBlameDataGasLimit
for i := 0; i < DefaultRetryCount; i++ {
zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner)
if err == nil {
return zetaTxHash, nil
}
b.logger.Error().Err(err).Msgf("PostBlame broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount)
}
func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, blockHash []byte, height int64, header common.HeaderData) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
msg := observerTypes.NewMsgAddBlockHeader(signerAddress, chainID, blockHash, height, header)
authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}
var gasLimit uint64 = DefaultGasLimit
for i := 0; i < DefaultRetryCount; i++ {
zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner)
if err == nil {
return zetaTxHash, nil
}
b.logger.Error().Err(err).Msgf("PostAddBlockHeader broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
return "", fmt.Errorf("post add block header failed after %d retries", DefaultRetryCount)
}
package zetaclient
import (
"bytes"
"context"
"encoding/base64"
"encoding/hex"
"fmt"
"math"
"math/big"
"strings"
"time"
sdkmath "cosmossdk.io/math"
"github.com/btcsuite/btcd/txscript"
ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
clienttypes "github.com/zeta-chain/zetacore/zetaclient/types"
)
const (
satoshiPerBitcoin = 1e8
)
func getSatoshis(btc float64) (int64, error) {
// The amount is only considered invalid if it cannot be represented
// as an integer type. This may happen if f is NaN or +-Infinity.
// BTC max amount is 21 mil and its at least 0 (Note: bitcoin allows creating 0-value outputs)
switch {
case math.IsNaN(btc):
fallthrough
case math.IsInf(btc, 1):
fallthrough
case math.IsInf(btc, -1):
return 0, errors.New("invalid bitcoin amount")
case btc > 21000000.0:
return 0, errors.New("exceeded max bitcoin amount")
case btc < 0.0:
return 0, errors.New("cannot be less than zero")
}
return round(btc * satoshiPerBitcoin), nil
}
func round(f float64) int64 {
if f < 0 {
// #nosec G701 always in range
return int64(f - 0.5)
}
// #nosec G701 always in range
return int64(f + 0.5)
}
func payToWitnessPubKeyHashScript(pubKeyHash []byte) ([]byte, error) {
return txscript.NewScriptBuilder().AddOp(txscript.OP_0).AddData(pubKeyHash).Script()
}
type DynamicTicker struct {
name string
interval uint64
impl *time.Ticker
}
func NewDynamicTicker(name string, interval uint64) *DynamicTicker {
return &DynamicTicker{
name: name,
interval: interval,
impl: time.NewTicker(time.Duration(interval) * time.Second),
}
}
func (t *DynamicTicker) C() <-chan time.Time {
return t.impl.C
}
func (t *DynamicTicker) UpdateInterval(newInterval uint64, logger zerolog.Logger) {
if newInterval > 0 && t.interval != newInterval {
t.impl.Stop()
oldInterval := t.interval
t.interval = newInterval
t.impl = time.NewTicker(time.Duration(t.interval) * time.Second)
logger.Info().Msgf("%s ticker interval changed from %d to %d", t.name, oldInterval, newInterval)
}
}
func (t *DynamicTicker) Stop() {
t.impl.Stop()
}
func (ob *EVMChainClient) GetInboundVoteMsgForDepositedEvent(event *erc20custody.ERC20CustodyDeposited) (types.MsgVoteOnObservedInboundTx, error) {
ob.logger.ExternalChainWatcher.Info().Msgf("TxBlockNumber %d Transaction Hash: %s Message : %s", event.Raw.BlockNumber, event.Raw.TxHash, event.Message)
if bytes.Compare(event.Message, []byte(DonationMessage)) == 0 {
ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation!: %s", event.Raw.TxHash.Hex())
return types.MsgVoteOnObservedInboundTx{}, fmt.Errorf("thank you rich folk for your donation!: %s", event.Raw.TxHash.Hex())
}
// get the sender of the event's transaction
tx, _, err := ob.evmClient.TransactionByHash(context.Background(), event.Raw.TxHash)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg(fmt.Sprintf("failed to get transaction by hash: %s", event.Raw.TxHash.Hex()))
return types.MsgVoteOnObservedInboundTx{}, errors.Wrap(err, fmt.Sprintf("failed to get transaction by hash: %s", event.Raw.TxHash.Hex()))
}
signer := ethtypes.NewLondonSigner(big.NewInt(ob.chain.ChainId))
sender, err := signer.Sender(tx)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg(fmt.Sprintf("can't recover the sender from the tx hash: %s", event.Raw.TxHash.Hex()))
return types.MsgVoteOnObservedInboundTx{}, errors.Wrap(err, fmt.Sprintf("can't recover the sender from the tx hash: %s", event.Raw.TxHash.Hex()))
}
return *GetInBoundVoteMessage(
sender.Hex(),
ob.chain.ChainId,
"",
clienttypes.BytesToEthHex(event.Recipient),
common.ZetaChain().ChainId,
sdkmath.NewUintFromBigInt(event.Amount),
hex.EncodeToString(event.Message),
event.Raw.TxHash.Hex(),
event.Raw.BlockNumber,
1_500_000,
common.CoinType_ERC20,
event.Asset.String(),
ob.zetaClient.GetKeys().GetOperatorAddress().String(),
), nil
}
func (ob *EVMChainClient) GetInboundVoteMsgForZetaSentEvent(event *zetaconnector.ZetaConnectorNonEthZetaSent) (types.MsgVoteOnObservedInboundTx, error) {
ob.logger.ExternalChainWatcher.Info().Msgf("TxBlockNumber %d Transaction Hash: %s Message : %s", event.Raw.BlockNumber, event.Raw.TxHash, event.Message)
destChain := common.GetChainFromChainID(event.DestinationChainId.Int64())
if destChain == nil {
ob.logger.ExternalChainWatcher.Warn().Msgf("chain id not supported %d", event.DestinationChainId.Int64())
return types.MsgVoteOnObservedInboundTx{}, fmt.Errorf("chain id not supported %d", event.DestinationChainId.Int64())
}
destAddr := clienttypes.BytesToEthHex(event.DestinationAddress)
if *destChain != common.ZetaChain() {
cfgDest, found := ob.cfg.GetEVMConfig(destChain.ChainId)
if !found {
return types.MsgVoteOnObservedInboundTx{}, fmt.Errorf("chain id not present in EVMChainConfigs %d", event.DestinationChainId.Int64())
}
if strings.EqualFold(destAddr, cfgDest.ZetaTokenContractAddress) {
ob.logger.ExternalChainWatcher.Warn().Msgf("potential attack attempt: %s destination address is ZETA token contract address %s", destChain, destAddr)
return types.MsgVoteOnObservedInboundTx{}, fmt.Errorf("potential attack attempt: %s destination address is ZETA token contract address %s", destChain, destAddr)
}
}
return *GetInBoundVoteMessage(
event.ZetaTxSenderAddress.Hex(),
ob.chain.ChainId,
event.SourceTxOriginAddress.Hex(),
clienttypes.BytesToEthHex(event.DestinationAddress),
destChain.ChainId,
sdkmath.NewUintFromBigInt(event.ZetaValueAndGas),
base64.StdEncoding.EncodeToString(event.Message),
event.Raw.TxHash.Hex(),
event.Raw.BlockNumber,
event.DestinationGasLimit.Uint64(),
common.CoinType_Zeta,
"",
ob.zetaClient.GetKeys().GetOperatorAddress().String(),
), nil
}
func (ob *EVMChainClient) GetInboundVoteMsgForTokenSentToTSS(txhash ethcommon.Hash, value *big.Int, receipt *ethtypes.Receipt, from ethcommon.Address, data []byte) *types.MsgVoteOnObservedInboundTx {
ob.logger.ExternalChainWatcher.Info().Msgf("TSS inTx detected: %s, blocknum %d", txhash.Hex(), receipt.BlockNumber)
ob.logger.ExternalChainWatcher.Info().Msgf("TSS inTx value: %s", value.String())
ob.logger.ExternalChainWatcher.Info().Msgf("TSS inTx from: %s", from.Hex())
message := ""
if len(data) != 0 {
message = hex.EncodeToString(data)
}
return GetInBoundVoteMessage(
from.Hex(),
ob.chain.ChainId,
from.Hex(),
from.Hex(),
common.ZetaChain().ChainId,
sdkmath.NewUintFromBigInt(value),
message,
txhash.Hex(),
receipt.BlockNumber.Uint64(),
90_000,
common.CoinType_Gas,
"",
ob.zetaClient.GetKeys().GetOperatorAddress().String(),
)
}
package zetaclient
import (
"fmt"
"sync"
"time"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp/params"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/hashicorp/go-retryablehttp"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/zetacore/app"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/common/cosmos"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
"google.golang.org/grpc"
)
var _ ZetaCoreBridger = &ZetaCoreBridge{}
// ZetaCoreBridge will be used to send tx to ZetaCore.
type ZetaCoreBridge struct {
logger zerolog.Logger
blockHeight int64
accountNumber map[common.KeyType]uint64
seqNumber map[common.KeyType]uint64
grpcConn *grpc.ClientConn
httpClient *retryablehttp.Client
cfg config.ClientConfiguration
encodingCfg params.EncodingConfig
keys *Keys
broadcastLock *sync.RWMutex
zetaChainID string
lastOutTxReportTime map[string]time.Time
stop chan struct{}
pause chan struct{}
}
// NewZetaCoreBridge create a new instance of ZetaCoreBridge
func NewZetaCoreBridge(k *Keys, chainIP string, signerName string, chainID string) (*ZetaCoreBridge, error) {
// main module logger
logger := log.With().Str("module", "CoreBridge").Logger()
cfg := config.ClientConfiguration{
ChainHost: fmt.Sprintf("%s:1317", chainIP),
SignerName: signerName,
SignerPasswd: "password",
ChainRPC: fmt.Sprintf("%s:26657", chainIP),
}
httpClient := retryablehttp.NewClient()
httpClient.Logger = nil
grpcConn, err := grpc.Dial(
fmt.Sprintf("%s:9090", chainIP),
grpc.WithInsecure(),
)
if err != nil {
logger.Error().Err(err).Msg("grpc dial fail")
return nil, err
}
accountsMap := make(map[common.KeyType]uint64)
seqMap := make(map[common.KeyType]uint64)
for _, keyType := range common.GetAllKeyTypes() {
accountsMap[keyType] = 0
seqMap[keyType] = 0
}
return &ZetaCoreBridge{
logger: logger,
grpcConn: grpcConn,
httpClient: httpClient,
accountNumber: accountsMap,
seqNumber: seqMap,
cfg: cfg,
encodingCfg: app.MakeEncodingConfig(),
keys: k,
broadcastLock: &sync.RWMutex{},
lastOutTxReportTime: map[string]time.Time{},
stop: make(chan struct{}),
zetaChainID: chainID,
pause: make(chan struct{}),
}, nil
}
// MakeLegacyCodec creates codec
func MakeLegacyCodec() *codec.LegacyAmino {
cdc := codec.NewLegacyAmino()
banktypes.RegisterLegacyAminoCodec(cdc)
authtypes.RegisterLegacyAminoCodec(cdc)
cosmos.RegisterCodec(cdc)
crosschaintypes.RegisterCodec(cdc)
return cdc
}
func (b *ZetaCoreBridge) GetLogger() *zerolog.Logger {
return &b.logger
}
func (b *ZetaCoreBridge) UpdateChainID(chainID string) {
if b.zetaChainID != chainID {
b.zetaChainID = chainID
}
}
func (b *ZetaCoreBridge) Stop() {
b.logger.Info().Msgf("ZetaBridge is stopping")
close(b.stop) // this notifies all configupdater to stop
}
// GetAccountNumberAndSequenceNumber We do not use multiple KeyType for now , but this can be optionally used in the future to seprate TSS signer from Zetaclient GRantee
func (b *ZetaCoreBridge) GetAccountNumberAndSequenceNumber(_ common.KeyType) (uint64, uint64, error) {
ctx := b.GetContext()
address := b.keys.GetAddress()
return ctx.AccountRetriever.GetAccountNumberSequence(ctx, address)
}
func (b *ZetaCoreBridge) SetAccountNumber(keyType common.KeyType) {
ctx := b.GetContext()
address := b.keys.GetAddress()
accN, seq, err := ctx.AccountRetriever.GetAccountNumberSequence(ctx, address)
if err != nil {
b.logger.Error().Err(err).Msg("fail to get account number and sequence number")
return
}
b.accountNumber[keyType] = accN
b.seqNumber[keyType] = seq
}
func (b *ZetaCoreBridge) WaitForCoreToCreateBlocks() {
retryCount := 0
for {
block, err := b.GetLatestZetaBlock()
if err == nil && block.Header.Height > 1 {
b.logger.Info().Msgf("Zeta-core height: %d", block.Header.Height)
break
}
retryCount++
b.logger.Debug().Msgf("Failed to get latest Block , Retry : %d/%d", retryCount, DefaultRetryCount)
if retryCount > ExtendedRetryCount {
panic(fmt.Sprintf("ZetaCore is not ready , Waited for %d seconds", DefaultRetryCount*DefaultRetryInterval))
}
time.Sleep(DefaultRetryInterval * time.Second)
}
}
func (b *ZetaCoreBridge) GetKeys() *Keys {
return b.keys
}
func (b *ZetaCoreBridge) UpdateConfigFromCore(cfg *config.Config, init bool) error {
bn, err := b.GetZetaBlockHeight()
if err != nil {
return err
}
plan, err := b.GetUpgradePlan()
// if there is no active upgrade plan, plan will be nil, err will be nil as well.
if err != nil {
return err
}
if plan != nil && bn == plan.Height-1 { // stop zetaclients; notify operator to upgrade and restart
b.logger.Warn().Msgf("Active upgrade plan detected and upgrade height reached: %s at height %d; ZetaClient is stopped; please kill this process, replace zetaclientd binary with upgraded version, and restart zetaclientd", plan.Name, plan.Height)
b.pause <- struct{}{} // notify CoreObserver to stop ChainClients, Signers, and CoreObservder itself
}
coreParams, err := b.GetCoreParams()
if err != nil {
return err
}
newEVMParams := make(map[int64]*observertypes.CoreParams)
var newBTCParams *observertypes.CoreParams
// check and update core params for each chain
for _, params := range coreParams {
err := config.ValidateCoreParams(params)
if err != nil {
b.logger.Debug().Err(err).Msgf("Invalid core params for chain %s", common.GetChainFromChainID(params.ChainId).ChainName)
}
if common.IsBitcoinChain(params.ChainId) {
newBTCParams = params
} else {
newEVMParams[params.ChainId] = params
}
}
chains, err := b.GetSupportedChains()
if err != nil {
return err
}
newChains := make([]common.Chain, len(chains))
for i, chain := range chains {
newChains[i] = *chain
}
keyGen, err := b.GetKeyGen()
if err != nil {
b.logger.Info().Msg("Unable to fetch keygen from zetacore")
}
cfg.UpdateCoreParams(keyGen, newChains, newEVMParams, newBTCParams, init, b.logger)
tss, err := b.GetCurrentTss()
if err != nil {
b.logger.Debug().Err(err).Msg("Unable to fetch TSS from zetacore")
} else {
cfg.CurrentTssPubkey = tss.GetTssPubkey()
}
return nil
}
func (b *ZetaCoreBridge) Pause() {
<-b.pause
}
func (b *ZetaCoreBridge) Unpause() {
b.pause <- struct{}{}
}
package zetaclient
import (
"fmt"
"strings"
"time"
"github.com/pkg/errors"
prom "github.com/prometheus/client_golang/prometheus"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
"github.com/zeta-chain/zetacore/zetaclient/metrics"
)
const (
OutboundTxSignCount = "zetaclient_Outbound_tx_sign_count"
)
type ZetaCoreLog struct {
ChainLogger zerolog.Logger
ZetaChainWatcher zerolog.Logger
}
// CoreObserver wraps the zetacore bridge and adds the client and signer maps to it . This is the high level object used for CCTX interactions
type CoreObserver struct {
bridge ZetaCoreBridger
signerMap map[common.Chain]ChainSigner
clientMap map[common.Chain]ChainClient
metrics *metrics.Metrics
logger ZetaCoreLog
cfg *config.Config
ts *TelemetryServer
stop chan struct{}
}
// NewCoreObserver creates a new CoreObserver
func NewCoreObserver(
bridge ZetaCoreBridger,
signerMap map[common.Chain]ChainSigner,
clientMap map[common.Chain]ChainClient,
metrics *metrics.Metrics,
logger zerolog.Logger,
cfg *config.Config,
ts *TelemetryServer,
) *CoreObserver {
co := CoreObserver{
ts: ts,
stop: make(chan struct{}),
}
co.cfg = cfg
chainLogger := logger.With().
Str("chain", "ZetaChain").
Logger()
co.logger = ZetaCoreLog{
ChainLogger: chainLogger,
ZetaChainWatcher: chainLogger.With().Str("module", "ZetaChainWatcher").Logger(),
}
co.bridge = bridge
co.signerMap = signerMap
co.clientMap = clientMap
co.metrics = metrics
co.logger.ChainLogger.Info().Msg("starting core observer")
err := metrics.RegisterCounter(OutboundTxSignCount, "number of Outbound tx signed")
if err != nil {
co.logger.ChainLogger.Error().Err(err).Msg("error registering counter")
}
return &co
}
func (co *CoreObserver) GetPromCounter(name string) (prom.Counter, error) {
cnt, found := metrics.Counters[name]
if !found {
return nil, errors.New("counter not found")
}
return cnt, nil
}
func (co *CoreObserver) MonitorCore() {
myid := co.bridge.GetKeys().GetAddress()
co.logger.ZetaChainWatcher.Info().Msgf("Starting Send Scheduler for %s", myid)
go co.startSendScheduler()
go func() {
// bridge queries UpgradePlan from zetacore and send to its pause channel if upgrade height is reached
co.bridge.Pause()
// now stop everything
close(co.stop) // this stops the startSendScheduler() loop
for _, c := range co.clientMap {
c.Stop()
}
}()
}
// ZetaCore block is heart beat; each block we schedule some send according to
// retry schedule. ses
func (co *CoreObserver) startSendScheduler() {
outTxMan := NewOutTxProcessorManager(co.logger.ChainLogger)
observeTicker := time.NewTicker(3 * time.Second)
var lastBlockNum int64
for {
select {
case <-co.stop:
co.logger.ZetaChainWatcher.Warn().Msg("stop sendScheduler")
return
case <-observeTicker.C:
{
bn, err := co.bridge.GetZetaBlockHeight()
if err != nil {
co.logger.ZetaChainWatcher.Error().Msg("GetZetaBlockHeight fail in startSendScheduler")
continue
}
if bn < 0 {
co.logger.ZetaChainWatcher.Error().Msg("GetZetaBlockHeight returned negative height")
continue
}
if lastBlockNum == 0 {
lastBlockNum = bn - 1
}
if bn > lastBlockNum { // we have a new block
bn = lastBlockNum + 1
if bn%10 == 0 {
co.logger.ZetaChainWatcher.Debug().Msgf("ZetaCore heart beat: %d", bn)
}
//logger.Info().Dur("elapsed", time.Since(tStart)).Msgf("GetAllPendingCctx %d", len(sendList))
supportedChains := GetSupportedChains()
for _, c := range supportedChains {
if c == nil || c.ChainId == common.ZetaChain().ChainId {
continue
}
signer := co.signerMap[*c]
cctxList, err := co.bridge.GetAllPendingCctx(c.ChainId)
if err != nil {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("failed to GetAllPendingCctx for chain %s", c.ChainName.String())
continue
}
ob, err := co.getUpdatedChainOb(c.ChainId)
if err != nil {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("getTargetChainOb fail, Chain ID: %s", c.ChainName)
continue
}
chain, err := common.GetChainNameFromChainID(c.ChainId)
if err != nil {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("GetTargetChain fail, Chain ID: %s", c.ChainName)
continue
}
res, err := co.bridge.GetAllOutTxTrackerByChain(*c, Ascending)
if err != nil {
co.logger.ZetaChainWatcher.Warn().Err(err).Msgf("failed to GetAllOutTxTrackerByChain for chain %s", c.ChainName.String())
continue
}
trackerMap := make(map[uint64]bool)
for _, v := range res {
trackerMap[v.Nonce] = true
}
gauge, err := ob.GetPromGauge(metrics.PendingTxs)
if err != nil {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("failed to get prometheus gauge: %s", metrics.PendingTxs)
continue
}
gauge.Set(float64(len(cctxList)))
for idx, cctx := range cctxList {
params := cctx.GetCurrentOutTxParam()
if params.ReceiverChainId != c.ChainId {
co.logger.ZetaChainWatcher.Error().Msgf("mismatch chainid: want %d, got %d", c.ChainId, params.ReceiverChainId)
continue
}
// #nosec G701 range is verified
currentHeight := uint64(bn)
nonce := params.OutboundTxTssNonce
outTxID := fmt.Sprintf("%s-%d-%d", cctx.Index, params.ReceiverChainId, nonce) // would outTxID a better ID?
// Process Bitcoin OutTx
if common.IsBitcoinChain(c.ChainId) {
if outTxMan.IsOutTxActive(outTxID) {
// bitcoun outTx is processed sequencially by nonce
// if the current outTx is being processed, there is no need to process outTx with future nonces
break
}
// #nosec G701 positive
if stop := co.processBitcoinOutTx(outTxMan, uint64(idx), cctx, signer, ob, currentHeight); stop {
break
}
continue
}
// Monitor Core Logger for OutboundTxTssNonce
included, _, err := ob.IsSendOutTxProcessed(cctx.Index, params.OutboundTxTssNonce, params.CoinType, co.logger.ZetaChainWatcher)
if err != nil {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("IsSendOutTxProcessed fail, Chain ID: %s", c.ChainName)
continue
}
if included {
co.logger.ZetaChainWatcher.Info().Msgf("send outTx already included; do not schedule")
continue
}
// #nosec G701 positive
interval := uint64(ob.GetCoreParams().OutboundTxScheduleInterval)
lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead
// determining critical outtx; if it satisfies following criteria
// 1. it's the first pending outtx for this chain
// 2. the following 5 nonces have been in tracker
criticalInterval := uint64(10) // for critical pending outTx we reduce re-try interval
nonCriticalInterval := interval * 2 // for non-critical pending outTx we increase re-try interval
if nonce%criticalInterval == currentHeight%criticalInterval {
count := 0
for i := nonce + 1; i <= nonce+10; i++ {
if _, found := trackerMap[i]; found {
count++
}
}
if count >= 5 {
interval = criticalInterval
}
}
// if it's already in tracker, we increase re-try interval
if _, ok := trackerMap[nonce]; ok {
interval = nonCriticalInterval
}
// otherwise, the normal interval is used
if nonce%interval == currentHeight%interval && !outTxMan.IsOutTxActive(outTxID) {
outTxMan.StartTryProcess(outTxID)
co.logger.ZetaChainWatcher.Debug().Msgf("chain %s: Sign outtx %s with value %d\n", chain, outTxID, cctx.GetCurrentOutTxParam().Amount)
go signer.TryProcessOutTx(cctx, outTxMan, outTxID, ob, co.bridge, currentHeight)
}
// #nosec G701 always in range
if int64(idx) >= lookahead-1 { // only look at 30 sends per chain
break
}
}
}
// update last processed block number
lastBlockNum = bn
co.ts.SetCoreBlockNumber(lastBlockNum)
}
}
}
}
}
// Bitcoin outtx is processed in a different way
// 1. schedule one keysign on each ticker
// 2. schedule keysign only when nonce-mark UTXO is available
// 3. stop processing when pendingNonce/lookahead is reached
//
// Returns whether to stop processing
func (co *CoreObserver) processBitcoinOutTx(outTxMan *OutTxProcessorManager, idx uint64, send *types.CrossChainTx, signer ChainSigner, ob ChainClient, currentHeight uint64) bool {
params := send.GetCurrentOutTxParam()
nonce := params.OutboundTxTssNonce
lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead
outTxID := fmt.Sprintf("%s-%d-%d", send.Index, params.ReceiverChainId, nonce)
// start go routine to process outtx
outTxMan.StartTryProcess(outTxID)
co.logger.ZetaChainWatcher.Debug().Msgf("Sign bitcoin outtx %s with value %d\n", outTxID, params.Amount)
go signer.TryProcessOutTx(send, outTxMan, outTxID, ob, co.bridge, currentHeight)
// get bitcoin client
btcClient, ok := ob.(*BitcoinChainClient)
if !ok { // should never happen
co.logger.ZetaChainWatcher.Error().Msgf("chain client is not a bitcoin client")
return true
}
// stop if the nonce being processed reaches the artificial pending nonce
if nonce >= btcClient.GetPendingNonce() {
return true
}
// stop if lookahead is reached. 2 bitcoin confirmations span is 20 minutes on average. We look ahead up to 100 pending cctx to target TPM of 5.
// #nosec G701 always in range
if int64(idx) >= lookahead-1 {
return true
}
return false // otherwise, continue
}
func (co *CoreObserver) getUpdatedChainOb(chainID int64) (ChainClient, error) {
chainOb, err := co.getTargetChainOb(chainID)
if err != nil {
return nil, err
}
// update chain client core parameters
curParams := chainOb.GetCoreParams()
if common.IsEVMChain(chainID) {
evmCfg, found := co.cfg.GetEVMConfig(chainID)
if found && curParams != evmCfg.CoreParams {
chainOb.SetCoreParams(evmCfg.CoreParams)
co.logger.ZetaChainWatcher.Info().Msgf("updated core params for chainID %d, new params: %v", chainID, evmCfg.CoreParams)
}
} else if common.IsBitcoinChain(chainID) {
_, btcCfg, found := co.cfg.GetBTCConfig()
if found && curParams != btcCfg.CoreParams {
chainOb.SetCoreParams(btcCfg.CoreParams)
co.logger.ZetaChainWatcher.Info().Msgf("updated core params for Bitcoin, new params: %v", btcCfg.CoreParams)
}
}
return chainOb, nil
}
func (co *CoreObserver) getTargetChainOb(chainID int64) (ChainClient, error) {
c := common.GetChainFromChainID(chainID)
if c == nil {
return nil, fmt.Errorf("chain not found for chainID %d", chainID)
}
chainOb, found := co.clientMap[*c]
if !found {
return nil, fmt.Errorf("chain client not found for chainID %d", chainID)
}
return chainOb, nil
}
// HandleBroadcastError returns whether to retry in a few seconds, and whether to report via AddTxHashToOutTxTracker
func HandleBroadcastError(err error, nonce, toChain, outTxHash string) (bool, bool) {
if strings.Contains(err.Error(), "nonce too low") {
log.Warn().Err(err).Msgf("nonce too low! this might be a unnecessary key-sign. increase re-try interval and awaits outTx confirmation")
return false, false
}
if strings.Contains(err.Error(), "replacement transaction underpriced") {
log.Warn().Err(err).Msgf("Broadcast replacement: nonce %s chain %s outTxHash %s", nonce, toChain, outTxHash)
return false, false
} else if strings.Contains(err.Error(), "already known") { // this is error code from QuickNode
log.Warn().Err(err).Msgf("Broadcast duplicates: nonce %s chain %s outTxHash %s", nonce, toChain, outTxHash)
return false, true // report to tracker, because there's possibilities a successful broadcast gets this error code
}
log.Error().Err(err).Msgf("Broadcast error: nonce %s chain %s outTxHash %s; retrying...", nonce, toChain, outTxHash)
return true, false
}